【问题标题】:how to hook ISmoothStreamCache object in SMFPlayer (Smooth Streaming Development kit)如何在 SMFPlayer 中挂钩 ISmoothStreamCache 对象(Smooth Streaming Development kit)
【发布时间】:2013-01-29 16:35:41
【问题描述】:

我在 SilverLight Smooth Streaming Development Kit 中使用 SMFPlayer。 而且我可以播放视频内容,但是出于某种原因,我们希望拥有 控制正在下载和解析的数据。为此,我们要开始使用 ISmoothStreamingCache 接口。 我想知道在 SMFPlayer 中挂钩 ISmoothStreamingCache 对象的正确方法是什么。

提前致谢

大O

【问题讨论】:

  • 仅供参考。确保你有一个空的构造函数。我必须查看玩家日志才能找到答案。

标签: smooth-streaming smooth-streaming-player


【解决方案1】:

ISmoothStreamingCache's 实现也应该实现IPlugin 接口。它也应该用ExportAdaptiveCacheProvider 属性装饰。

然后会自动挂接到SMFPlayer。

下面是类的骨架代码:

using System;
using System.Collections.Generic;
using System.IO.IsolatedStorage;
using System.Net;
using Microsoft.SilverlightMediaFramework.Plugins;
using Microsoft.SilverlightMediaFramework.Plugins.Metadata;
using Microsoft.Web.Media.SmoothStreaming;

namespace MyNamespace
{
    [ExportAdaptiveCacheProvider(PluginName = "My Smooth Streaming Cache")]
    public class MySmoothStreamingCache : ISmoothStreamingCache, IPlugin
    {
        public MySmoothStreamingCache()
        {
            // Your implementation
        }

        #region ISmoothStreamingCache members
        public IAsyncResult BeginRetrieve(CacheRequest request, AsyncCallback callback, object state)
        {
            // Your implementation
        }

        public CacheResponse EndRetrieve(IAsyncResult ar)
        {
            // Your implementation
        }

        public IAsyncResult BeginPersist(CacheRequest request, CacheResponse response, AsyncCallback callback, object state)
        {
            // Your implementation
        }

        public bool EndPersist(IAsyncResult ar)
        {
            // Your implementation
        }

        public void OpenMedia(Uri manifestUri)
        {
            // Your implementation
        }

        public void CloseMedia(Uri manifestUri)
        {
            // Your implementation
        }
        #endregion

        #region IPlugin members
        public bool IsLoaded { get; private set; }

        public void Load()
        {
            IsLoaded = true;
        }

        public event Action<IPlugin, Microsoft.SilverlightMediaFramework.Plugins.Primitives.LogEntry> LogReady;

        public event Action<IPlugin, Exception> PluginLoadFailed;

        public event Action<IPlugin> PluginLoaded;

        public event Action<IPlugin, Exception> PluginUnloadFailed;

        public event Action<IPlugin> PluginUnloaded;

        public void Unload()
        {
            IsLoaded = false;
        }
        #endregion
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-02-13
    • 1970-01-01
    • 2023-02-04
    • 2014-05-31
    • 2020-05-31
    • 1970-01-01
    • 2010-12-29
    相关资源
    最近更新 更多