コード例 #1
0
        void SetupProtectionManager(MediaElement mediaElement)
        {
            TestLogger.LogMessage("Enter Playback.SetupProtectionManager()");

            _mediaElement = mediaElement;

            TestLogger.LogMessage("Creating protection system mappings...");
            _protectionManager = new MediaProtectionManager();

            _protectionManager.ComponentLoadFailed += new ComponentLoadFailedEventHandler(ProtectionManager_ComponentLoadFailed);
            _protectionManager.ServiceRequested    += new ServiceRequestedEventHandler(ProtectionManager_ServiceRequested);

            TestLogger.LogMessage("Creating protection system mappings...");
            //Setup PlayReady as the ProtectionSystem to use by MF.
            //The code here is mandatory and should be just copied directly over to the app
            Windows.Foundation.Collections.PropertySet cpSystems = new Windows.Foundation.Collections.PropertySet();

            //Indicate to the MF pipeline to use PlayReady's TrustedInput
            cpSystems.Add("{F4637010-03C3-42CD-B932-B48ADF3A6A54}", "Windows.Media.Protection.PlayReady.PlayReadyWinRTTrustedInput");
            _protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemIdMapping", cpSystems);
            //Use by the media stream source about how to create ITA InitData.
            //See here for more detai: https://msdn.microsoft.com/en-us/library/windows/desktop/aa376846%28v=vs.85%29.aspx
            _protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemId", "{F4637010-03C3-42CD-B932-B48ADF3A6A54}");

            // Setup the container GUID that's in the PPSH box
            _protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionContainerGuid", "{9A04F079-9840-4286-AB92-E65BE0885F95}");

            TestLogger.LogMessage("Creating media extension manager...");
            _extensions = new Windows.Media.MediaExtensionManager();

            TestLogger.LogMessage("Registering ByteStreamHandlers for PIFF content");
            _extensions.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism", "text/xml");
            _extensions.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism", "application/vnd.ms-sstr+xml");

            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            //Setup Software Override based on app setting
            //By default, PlayReady uses Hardware DRM if the machine support it. However, in case the app still want
            //software behavior, they can set localSettings.Containers["PlayReady"].Values["SoftwareOverride"]=1.
            //This code tells MF to use software override as well
            if (localSettings.Containers.ContainsKey("PlayReady") &&
                localSettings.Containers["PlayReady"].Values.ContainsKey("SoftwareOverride"))
            {
                int UseSoftwareProtectionLayer = (int)localSettings.Containers["PlayReady"].Values["SoftwareOverride"];

                if (UseSoftwareProtectionLayer == 1)
                {
                    TestLogger.LogMessage(" ");
                    TestLogger.LogMessage("***** Use Software Protection Layer ******");
                    _protectionManager.Properties.Add("Windows.Media.Protection.UseSoftwareProtectionLayer", true);
                }
            }

            _mediaElement.ProtectionManager = _protectionManager;

            TestLogger.LogMessage("Leave Playback.SetProtectionManager()");
        }
コード例 #2
0
        public void UpdateGameProgress(float percent)
        {
            var measurements = new Windows.Foundation.Collections.PropertySet();

            measurements.Add("CompletionPercent", percent);

            var dimensions = new Windows.Foundation.Collections.PropertySet();

            dimensions.Add("UserId", LiveResources.GetInstance().User.XboxUserId);

            AchievementManager.GetInstance().WriteGameEvent("GameProgress", dimensions, measurements);
            System.Diagnostics.Debug.WriteLine("Wrote game event: GameProgress");
        }
コード例 #3
0
        /// <summary>
        /// Unlock First Dead Achievement
        /// </summary>
        /// <param name="totalDeadCount">TotalDeadCount</param>
        public void UnlockFirstDeath(int totalDeadCount)
        {
            var measurements = new Windows.Foundation.Collections.PropertySet();

            measurements.Add("TotalDeadCount", totalDeadCount);

            var dimensions = new Windows.Foundation.Collections.PropertySet();

            dimensions.Add("UserId", LiveResources.GetInstance().User.XboxUserId);

            AchievementManager.GetInstance().WriteGameEvent("LevelTotalDataUpdate", dimensions, measurements);
            System.Diagnostics.Debug.WriteLine("Wrote game event: LevelTotalDataUpdate");
        }
コード例 #4
0
        void InitPlayReady()
        {
            var protectionManager = new MediaProtectionManager();
            protectionManager.ComponentLoadFailed += ProtectionManager_ComponentLoadFailed;
            protectionManager.ServiceRequested += ProtectionManager_ServiceRequested;

            Windows.Foundation.Collections.PropertySet cpSystems = new Windows.Foundation.Collections.PropertySet();
            cpSystems.Add("{F4637010-03C3-42CD-B932-B48ADF3A6A54}", "Microsoft.Media.PlayReadyClient.PlayReadyWinRTTrustedInput"); //Playready
            protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemIdMapping", cpSystems);
            protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemId", "{F4637010-03C3-42CD-B932-B48ADF3A6A54}");

            player.ProtectionManager = protectionManager;
        }
コード例 #5
0
        void InitPlayReady()
        {
            var protectionManager = new MediaProtectionManager();

            protectionManager.ComponentLoadFailed += ProtectionManager_ComponentLoadFailed;
            protectionManager.ServiceRequested    += ProtectionManager_ServiceRequested;

            Windows.Foundation.Collections.PropertySet cpSystems = new Windows.Foundation.Collections.PropertySet();
            cpSystems.Add("{F4637010-03C3-42CD-B932-B48ADF3A6A54}", "Microsoft.Media.PlayReadyClient.PlayReadyWinRTTrustedInput"); //Playready
            protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemIdMapping", cpSystems);
            protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemId", "{F4637010-03C3-42CD-B932-B48ADF3A6A54}");

            player.ProtectionManager = protectionManager;
        }
コード例 #6
0
        private void _initialiseMediaProtectionManager(MediaElement mediaElement)
        { 
            var mediaProtectionManager = new Windows.Media.Protection.MediaProtectionManager(); 
            mediaProtectionManager.Properties["Windows.Media.Protection.MediaProtectionContainerGuid"] = "{9A04F079-9840-4286-AB92-E65BE0885F95}"; // Setup the container GUID for CFF 

            var cpsystems = new Windows.Foundation.Collections.PropertySet(); 
            cpsystems["{F4637010-03C3-42CD-B932-B48ADF3A6A54}"] = "Windows.Media.Protection.PlayReady.PlayReadyWinRTTrustedInput"; // PlayReady 
            mediaProtectionManager.Properties["Windows.Media.Protection.MediaProtectionSystemIdMapping"] = cpsystems; 
            mediaProtectionManager.Properties["Windows.Media.Protection.MediaProtectionSystemId"] = "{F4637010-03C3-42CD-B932-B48ADF3A6A54}"; 
 
            mediaElement.ProtectionManager = mediaProtectionManager; 
 
            mediaProtectionManager.ServiceRequested += MediaProtectionManager_ServiceRequested; 
        }
コード例 #7
0
        private void _initialiseMediaProtectionManager(MediaElement mediaElement)
        {
            var mediaProtectionManager = new Windows.Media.Protection.MediaProtectionManager();

            mediaProtectionManager.Properties["Windows.Media.Protection.MediaProtectionContainerGuid"] = "{9A04F079-9840-4286-AB92-E65BE0885F95}"; // Setup the container GUID for CFF

            var cpsystems = new Windows.Foundation.Collections.PropertySet();

            cpsystems["{F4637010-03C3-42CD-B932-B48ADF3A6A54}"] = "Windows.Media.Protection.PlayReady.PlayReadyWinRTTrustedInput"; // PlayReady
            mediaProtectionManager.Properties["Windows.Media.Protection.MediaProtectionSystemIdMapping"] = cpsystems;
            mediaProtectionManager.Properties["Windows.Media.Protection.MediaProtectionSystemId"]        = "{F4637010-03C3-42CD-B932-B48ADF3A6A54}";

            mediaElement.ProtectionManager = mediaProtectionManager;

            mediaProtectionManager.ServiceRequested += MediaProtectionManager_ServiceRequested;
        }
コード例 #8
0
        public MainPage()
        {
            this.InitializeComponent();

            //<SnippetSetUpMediaProtectionManager>
            MediaProtectionManager protectionManager = new MediaProtectionManager();

            protectionManager.Properties.Add(
                "Windows.Media.Protection.MediaProtectionContainerGuid",
                PlayReadyStatics.ProtectionSystemId.ToString());
            Windows.Foundation.Collections.PropertySet cpSystems =
                new Windows.Foundation.Collections.PropertySet();
            cpSystems.Add(
                PlayReadyStatics.MediaProtectionSystemId.ToString(),
                PlayReadyStatics.InputTrustAuthorityToCreate);
            //</SnippetSetUpMediaProtectionManager>
        }
コード例 #9
0
        static public PlayReadyLicenseSession createLicenseSession()
        {
            //A setting to tell MF that we are using PlayReady.
            var propSetMF = new Windows.Foundation.Collections.PropertySet();
            propSetMF["Windows.Media.Protection.MediaProtectionSystemId"] = "{F4637010-03C3-42CD-B932-B48ADF3A6A54}";
            var cpsystems = new Windows.Foundation.Collections.PropertySet();
            cpsystems["{F4637010-03C3-42CD-B932-B48ADF3A6A54}"] = "Windows.Media.Protection.PlayReady.PlayReadyWinRTTrustedInput"; //Playready TrustedInput Class Name
            propSetMF["Windows.Media.Protection.MediaProtectionSystemIdMapping"] = cpsystems;

            //Create the MF media session that the license will be tied to
            var pmpServer = new Windows.Media.Protection.MediaProtectionPMPServer(propSetMF);

            var propSetPMPServer = new Windows.Foundation.Collections.PropertySet();
            //Set the property for the LicenseSession. This tells PlayReady to tie the license to that particular media session
            propSetPMPServer["Windows.Media.Protection.MediaProtectionPMPServer"] = pmpServer;

            var licenseSession = new Windows.Media.Protection.PlayReady.PlayReadyLicenseSession(propSetPMPServer);
            return licenseSession;
        }
コード例 #10
0
        public PlayReadyLicenseSession createLicenseSession()
        {
            Debug.WriteLine("Enter createLicenseSession");

            //A setting to tell MF that we are using PlayReady.
            var propSet = new Windows.Foundation.Collections.PropertySet();

            propSet["Windows.Media.Protection.MediaProtectionSystemId"] = "{F4637010-03C3-42CD-B932-B48ADF3A6A54}";

            var cpsystems = new Windows.Foundation.Collections.PropertySet();

            cpsystems["{F4637010-03C3-42CD-B932-B48ADF3A6A54}"] =
                "Windows.Media.Protection.PlayReady.PlayReadyWinRTTrustedInput"; //Playready TrustedInput Class Name
            propSet["Windows.Media.Protection.MediaProtectionSystemIdMapping"] = cpsystems;

            Windows.Storage.ApplicationDataContainer localSettings =
                Windows.Storage.ApplicationData.Current.LocalSettings;

            if (localSettings.Containers.ContainsKey("PlayReady") &&
                localSettings.Containers["PlayReady"].Values.ContainsKey("SoftwareOverride"))
            {
                int UseSoftwareProtectionLayer = (int)localSettings.Containers["PlayReady"].Values["SoftwareOverride"];

                if (UseSoftwareProtectionLayer == 1)
                {
                    Debug.WriteLine(" ");
                    Debug.WriteLine("***** Use Software Protection Layer for createLicenseSession ******");
                    propSet["Windows.Media.Protection.UseSoftwareProtectionLayer"] = true;
                }
            }

            //Create the MF media session that the license will be tied to
            var pmpServer = new Windows.Media.Protection.MediaProtectionPMPServer(propSet);

            var propSet2 = new Windows.Foundation.Collections.PropertySet();

            //Set the property for the LicenseSession. This tells PlayReady to tie the license to that particular media session
            propSet2["Windows.Media.Protection.MediaProtectionPMPServer"] = pmpServer;

            this.licenseSession = new Windows.Media.Protection.PlayReady.PlayReadyLicenseSession(propSet2);
            Debug.WriteLine("Exit createLicenseSession");
            return(this.licenseSession);
        }
コード例 #11
0
 /// <summary>
 /// The wrapper method of writing game event
 /// </summary>
 /// <param name="gameEventName">Game Event Name</param>
 /// <param name="dimensions">Dimensions include event fields with a finite number of defined numeric or string values. Examples of dimensions: map id, difficulty level, character or weapon class, game mode, boolean settings, etc.</param>
 /// <param name="measurements">Measurements include event fields that represent scalar numeric metrics. Examples of measurements: score, time, counters, position, etc.</param>
 public void WriteGameEvent(string gameEventName, Windows.Foundation.Collections.PropertySet dimensions = null, Windows.Foundation.Collections.PropertySet measurements = null)
 {
     if (liveResource != null && liveResource.LiveContext != null)
     {
         try
         {
             liveResource.LiveContext.EventsService.WriteInGameEvent(gameEventName, dimensions, measurements);
         }
         catch (Exception ex)
         {
             // Handle errors
             Debug.WriteLine($"Failed to write event, exception:\r\n{ex.Message}");
             throw;
         }
     }
     else
     {
         Debug.WriteLine("Please Sign in");
     }
 }
コード例 #12
0
ファイル: PlayReadyHelpers.cs プロジェクト: ice0/test
        static public MediaProtectionManager InitializeProtectionManager(ServiceRequestedEventHandler serviceRequestHandler)
        {
            var protectionManager = new MediaProtectionManager();

            //A setting to tell MF that we are using PlayReady.
            var props = new Windows.Foundation.Collections.PropertySet();

            props.Add("{F4637010-03C3-42CD-B932-B48ADF3A6A54}", "Windows.Media.Protection.PlayReady.PlayReadyWinRTTrustedInput");
            protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemIdMapping", props);
            protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemId", "{F4637010-03C3-42CD-B932-B48ADF3A6A54}");
            //Maps the conatiner guid from the manifest or media segment
            protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionContainerGuid", "{9A04F079-9840-4286-AB92-E65BE0885F95}");

            protectionManager.ServiceRequested    += new ServiceRequestedEventHandler(serviceRequestHandler);
            protectionManager.ComponentLoadFailed += new ComponentLoadFailedEventHandler(ComponentLoadFailed);

            // Windows 10 provides built in support for Dash and does not require additional configuration.
            // This would be be good place to configure a MediaExtensionManager to support another stream source
            // such as the Smooth Streaming SDK

            return(protectionManager);
        }
コード例 #13
0
        protected void LoadThumbnailAsync(NetworkItemInfo item, ICollection <Thumbnail> thumbnailList, bool useUnsupportedThumbnail, int codePage)
        {
            var thumbnail = thumbnailList?.FirstOrDefault(x => x.Name == item.Name.ToLower() && x.ParentPath == item.ParentFolderPath.ToLower() &&
                                                          x.Size == (ulong)item.Size && x.CreatedDateTime == item.Modified);

            if (thumbnail == null)
            {
                //썸네일 로드
                if (useUnsupportedThumbnail)
                {
                    var url = item.GetAuthenticateUrl(Settings.Server);
                    Windows.Foundation.Collections.PropertySet ps = new Windows.Foundation.Collections.PropertySet();
                    ps["codepage"] = codePage;
                    var ffInfo = CCPlayer.UWP.Factory.MediaInformationFactory.CreateMediaInformationFromUri(url, ps);
                    LoadThumbnailFromMediaInformaion(item, ffInfo);
                }
            }
            else if (useUnsupportedThumbnail)
            {
                //캐싱 이미지 로드
                LoadCachedThumbnail(item, thumbnail);
            }
        }
コード例 #14
0
ファイル: PlayReadyHelpers.cs プロジェクト: ice0/test
        static public PlayReadyLicenseSession createLicenseSession()
        {
            //A setting to tell MF that we are using PlayReady.
            var propSetMF = new Windows.Foundation.Collections.PropertySet();

            propSetMF["Windows.Media.Protection.MediaProtectionSystemId"] = "{F4637010-03C3-42CD-B932-B48ADF3A6A54}";
            var cpsystems = new Windows.Foundation.Collections.PropertySet();

            cpsystems["{F4637010-03C3-42CD-B932-B48ADF3A6A54}"] = "Windows.Media.Protection.PlayReady.PlayReadyWinRTTrustedInput"; //Playready TrustedInput Class Name
            propSetMF["Windows.Media.Protection.MediaProtectionSystemIdMapping"] = cpsystems;

            //Create the MF media session that the license will be tied to
            var pmpServer = new Windows.Media.Protection.MediaProtectionPMPServer(propSetMF);

            var propSetPMPServer = new Windows.Foundation.Collections.PropertySet();

            //Set the property for the LicenseSession. This tells PlayReady to tie the license to that particular media session
            propSetPMPServer["Windows.Media.Protection.MediaProtectionPMPServer"] = pmpServer;

            var licenseSession = new Windows.Media.Protection.PlayReady.PlayReadyLicenseSession(propSetPMPServer);

            return(licenseSession);
        }
コード例 #15
0
        static public MediaProtectionManager InitializeProtectionManager(ServiceRequestedEventHandler serviceRequestHandler)
        {

            var protectionManager = new MediaProtectionManager();

            //A setting to tell MF that we are using PlayReady.
            var props = new Windows.Foundation.Collections.PropertySet();
            props.Add("{F4637010-03C3-42CD-B932-B48ADF3A6A54}", "Windows.Media.Protection.PlayReady.PlayReadyWinRTTrustedInput");
            protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemIdMapping", props);
            protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemId", "{F4637010-03C3-42CD-B932-B48ADF3A6A54}");
            //Maps the conatiner guid from the manifest or media segment
            protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionContainerGuid", "{9A04F079-9840-4286-AB92-E65BE0885F95}");

            protectionManager.ServiceRequested += new ServiceRequestedEventHandler(serviceRequestHandler);
            protectionManager.ComponentLoadFailed += new ComponentLoadFailedEventHandler(ComponentLoadFailed);

            // Windows 10 provides built in support for Dash and does not require additional configuration. 
            // This would be be good place to configure a MediaExtensionManager to support another stream source 
            // such as the Smooth Streaming SDK

            return protectionManager;

        }
コード例 #16
0
        // Method not used in this sample.
        // This shows the minimal configuration for basic reactive playback.
        public void MinConfig(MediaElement mediaElement)
        {
            var manager = new MediaProtectionManager();
            var props   = new Windows.Foundation.Collections.PropertySet();

            props.Add("{F4637010-03C3-42CD-B932-B48ADF3A6A54}", "Windows.Media.Protection.PlayReady.PlayReadyWinRTTrustedInput");
            manager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemIdMapping", props);
            manager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemId", "{F4637010-03C3-42CD-B932-B48ADF3A6A54}");
            manager.Properties.Add("Windows.Media.Protection.MediaProtectionContainerGuid", "{9A04F079-9840-4286-AB92-E65BE0885F95}");

            MediaProtectionServiceCompletion completionNotifer = null;

            manager.ServiceRequested += async(sender, srEvent) =>
            {
                completionNotifer = srEvent.Completion;
                var serviceRequest = (IPlayReadyServiceRequest)srEvent.Request;

                ProcessServiceRequest(serviceRequest);
                if (serviceRequest is PlayReadyIndividualizationServiceRequest)
                {
                    var indivRequest = serviceRequest as PlayReadyIndividualizationServiceRequest;
                    await indivRequest.BeginServiceRequest();

                    serviceCompletionNotifier.Complete(true);
                }
                else if (serviceRequest is PlayReadyLicenseAcquisitionServiceRequest)
                {
                    var licenseRequest = serviceRequest as PlayReadyLicenseAcquisitionServiceRequest;
                    //licenseRequest.
                    await licenseRequest.BeginServiceRequest();

                    serviceCompletionNotifier.Complete(true);
                    serviceCompletionNotifier = null;
                }
            };
            mediaElement.ProtectionManager = manager;
        }
コード例 #17
0
ファイル: MediaCache.cs プロジェクト: flecoqui/Windows10
        /// <summary>
        /// Method: Initialize 
        /// Initialize the cache
        /// Parameter: container is a string defining the folder name where the cache will be stored on disk under folder
        /// \Users\<UserName>\AppData\Local\Packages\<PackageID>\LocalState
        /// Parameter: bDownloadToGo if true DownloadToGo scenario (offline playback), if false ProgressiveDownload scenario
        /// Parameter: maxDownloadSession maximum number of simultaneous download sessions
        /// Parameter: maxDownloadSession maximum number of simultaneous download sessions
        /// Parameter: maxMemoryBufferSizePerSession maximum buffer size per session, when the size if over this value, the chunks will be saved on disk and freed from memory.
        /// Parameter: maxDownloadedAssets maximum number of asset on disk
        /// Parameter: maxError maximum number of http error while downloading the chunks associated with an asset. When this value is reached the download thread will be cancelled
        /// Parameter: bAutoStartDownload if true after a resume the cache will start automatically the download 
        /// </summary>
        public IAsyncOperation<bool> Initialize(string container, uint maxDownloadSession, ulong maxMemoryBufferSizePerSession, uint maxDownloadedAssets, uint maxError, bool bAutoStartDownload)
        {
            return Task.Run<bool>(async () =>
            {
                if (ManifestCacheList != null)
                    Uninitialize();
                Container = container;


                MaxError = maxError;
                MaxMemoryBufferSizePerSession = maxMemoryBufferSizePerSession;
                MaxDownloadSessions = maxDownloadSession;
                MaxDownloadedAssets = maxDownloadedAssets;
                AutoStartDownload = bAutoStartDownload;

                // SMOOTH
                // Init Adaptative Manager
                AdaptiveSrcManager = AdaptiveSourceManager.GetDefault();
                AdaptiveSrcManager.SetDownloaderPlugin(this);
                AdaptiveSrcManager.AdaptiveSourceOpenedEvent += AdaptiveSrcManager_AdaptiveSourceOpenedEvent;
                AdaptiveSrcManager.AdaptiveSourceClosedEvent += AdaptiveSrcManager_AdaptiveSourceClosedEvent;


                // SMOOTH
                // Init SMOOTH Manager
                SmoothStreamingManager = Microsoft.Media.AdaptiveStreaming.AdaptiveSourceManager.GetDefault() as Microsoft.Media.AdaptiveStreaming.AdaptiveSourceManager;
                Extension = new Windows.Media.MediaExtensionManager();
                if ((SmoothStreamingManager != null) &&
                    (Extension != null))
                {
                    Windows.Foundation.Collections.PropertySet ssps = new Windows.Foundation.Collections.PropertySet();
                    ssps["{A5CE1DE8-1D00-427B-ACEF-FB9A3C93DE2D}"] = SmoothStreamingManager;


                    Extension.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism", "text/xml", ssps);
                    Extension.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism", "application/vnd.ms-sstr+xml", ssps);
                    Extension.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".isml", "text/xml", ssps);
                    Extension.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".isml", "application/vnd.ms-sstr+xml", ssps);


                    Extension.RegisterSchemeHandler("Microsoft.Media.AdaptiveStreaming.SmoothSchemeHandler", "ms-sstr:", ssps);
                    Extension.RegisterSchemeHandler("Microsoft.Media.AdaptiveStreaming.SmoothSchemeHandler", "ms-sstrs:", ssps);

                    SmoothStreamingManager.ManifestReadyEvent += SmoothStreamingManager_ManifestReadyEvent;
                    SmoothStreamingManager.SetDownloaderPlugin(this);
                }

                if (diskCache == null)
                {
                    diskCache = new DiskCache();
                    if (diskCache != null)
                    {
                        bool bResult = false;
                        bResult = await diskCache.Initialize(Container);
                        if (bResult != true)
                        {
                            System.Diagnostics.Debug.WriteLine("Can't initialize DiskCache");
                            return false;
                        }
                    }
                }
                if (ManifestCacheList == null)
                    ManifestCacheList = new ConcurrentDictionary<Uri, ManifestCache>();
                if (ManifestCacheList != null)
                    IsInitialized = true;
                return IsInitialized;
            }).AsAsyncOperation<bool>();
        }
コード例 #18
0
        private void ShowFlyout(Message <DecoderTypes> message)
        {
            Task.Factory.StartNew(async() =>
            {
                string displayName = null;
                IMediaInformation mediaInformation = null;
                if (message.ContainsKey("StorageItemInfo"))
                {
                    var sii        = message.GetValue <StorageItemInfo>("StorageItemInfo");
                    StorageFile sf = await sii.GetStorageFileAsync();
                    if (sf != null)
                    {
                        try
                        {
                            var stream       = await sf.OpenReadAsync();
                            mediaInformation = MediaInformationFactory.CreateMediaInformationFromStream(stream);
                            displayName      = sf.DisplayName;
                        }
                        catch (Exception e)
                        {
                            System.Diagnostics.Debug.WriteLine("로컬 파일 열기 실패 : " + e.Message);
                        }
                    }
                }
                else if (message.ContainsKey("NetworkItemInfo"))
                {
                    var wdii = message.GetValue <NetworkItemInfo>("NetworkItemInfo");

                    if (message.ContainsKey("VideoStream"))
                    {
                        Stream videoStream = message.GetValue <Stream>("VideoStream");
                        mediaInformation   = MediaInformationFactory.CreateMediaInformationFromStream(videoStream.AsRandomAccessStream());
                        displayName        = wdii.Name;
                    }
                    else
                    {
                        if (wdii.Uri != null)
                        {
                            try
                            {
                                string url = wdii.Uri.AbsoluteUri;
                                Windows.Foundation.Collections.PropertySet ps = null;

                                if (message.ContainsKey("UserName"))
                                {
                                    string username = message.GetValue <string>("UserName");
                                    string password = message.GetValue <string>("Password");
                                    url             = wdii.GetAuthenticateUrl(username, password);
                                }

                                if (message.ContainsKey("CodePage"))
                                {
                                    int codepage   = message.GetValue <int>("CodePage");
                                    ps             = new Windows.Foundation.Collections.PropertySet();
                                    ps["codepage"] = codepage;
                                }

                                mediaInformation = MediaInformationFactory.CreateMediaInformationFromUri(url, ps);
                                displayName      = wdii.Name;
                            }
                            catch (Exception e)
                            {
                                System.Diagnostics.Debug.WriteLine("리모트(Uri) 파일 열기 실패 : " + e.Message);
                            }
                        }
                    }
                }

                await DispatcherHelper.RunAsync(async() =>
                {
                    MessengerInstance.Send(new Message("IsOpen", false), "ShowLoadingPanel");

                    if (mediaInformation == null)
                    {
                        System.Diagnostics.Debug.WriteLine("에러 발생.");
                        var resource = ResourceLoader.GetForCurrentView();
                        var dlg      = DialogHelper.GetSimpleContentDialog(
                            resource.GetString("Message/Error/LoadMedia"),
                            resource.GetString("Message/Error/CheckFile"),
                            resource.GetString("Button/Close/Content"));
                        await dlg.ShowAsync();
                        App.ContentDlgOp = null;
                    }
                    else
                    {
                        var btnName       = message.GetValue <string>("ButtonName");
                        _PlaybackCallback = message.Action;
                        //기본 디코더로 설정
                        mediaInformation.RecommendedDecoderType = Settings.Playback.DefaultDecoderType;
                        //선택된 정보 저장
                        mediaInformation.Title  = displayName;
                        CurrentMediaInformation = mediaInformation;

                        StorageItemCodecSource.Clear();
                        foreach (var codecGroup in CurrentMediaInformation.CodecInformationList
                                 .GroupBy(x => x.CodecType).OrderBy(x => x.Key)
                                 .Select(x => new StorageItemCodec((MediaStreamTypes)x.Key)
                        {
                            Items = new ObservableCollection <CodecInformation>(x.ToArray())
                        }))
                        {
                            StorageItemCodecSource.Add(codecGroup);
                        }
                        Views.MainPage page = (Window.Current.Content as Frame).Content as Views.MainPage;
                        var button          = ElementHelper.FindVisualChild <Button>(page, btnName);

                        //정보창 표시
                        button.Flyout.ShowAt(button);
                    }
                });
            });
        }
コード例 #19
0
        // Method not used in this sample. 
        // This shows the minimal configuration for basic reactive playback.
        public void MinConfig(MediaElement mediaElement)
        {
            var manager = new MediaProtectionManager();
            var props = new Windows.Foundation.Collections.PropertySet();
            props.Add("{F4637010-03C3-42CD-B932-B48ADF3A6A54}", "Windows.Media.Protection.PlayReady.PlayReadyWinRTTrustedInput");
            manager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemIdMapping", props);
            manager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemId", "{F4637010-03C3-42CD-B932-B48ADF3A6A54}");
            manager.Properties.Add("Windows.Media.Protection.MediaProtectionContainerGuid", "{9A04F079-9840-4286-AB92-E65BE0885F95}");

            MediaProtectionServiceCompletion completionNotifer = null;
            manager.ServiceRequested += async (sender, srEvent) =>
            {
                completionNotifer = srEvent.Completion;
                var serviceRequest = (IPlayReadyServiceRequest)srEvent.Request;
               
                ProcessServiceRequest(serviceRequest);
                if (serviceRequest is PlayReadyIndividualizationServiceRequest)
                {
                    var indivRequest = serviceRequest as PlayReadyIndividualizationServiceRequest;
                    await indivRequest.BeginServiceRequest();
                    serviceCompletionNotifier.Complete(true);
                }
                else if (serviceRequest is PlayReadyLicenseAcquisitionServiceRequest)
                {
                    var licenseRequest = serviceRequest as PlayReadyLicenseAcquisitionServiceRequest;
                    //licenseRequest.
                    await licenseRequest.BeginServiceRequest();
                    serviceCompletionNotifier.Complete(true);
                    serviceCompletionNotifier = null;
                }

            };
            mediaElement.ProtectionManager = manager;
        }