2013-02-13 41 views
1

我在SilverLight Smooth Streaming Development Kit中使用SMFPlayer。 而且我可以播放視頻內容,但由於某些原因,我們希望對數據進行下載和解析時可以控制 。爲此我們想要開始使用 ISmoothStreamingCache接口。 我想知道什麼是在SMFPlayer中掛鉤ISmoothStreamingCache對象的正確方法。如何掛接SMFPlayer中的ISmoothStreamCache對象(Smooth Streaming Development Kit)

在此先感謝

大O

+0

僅供參考。確保你有一個空的構造函數。我必須檢查玩家日誌才能找到。 – 2014-02-03 05:38:03

回答

0

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 
    } 
} 
相關問題