private void InitializeSmoothStreaming()
        {
            extensions = new MediaExtensionManager();
            propertySet = new Windows.Foundation.Collections.PropertySet();

            // Gets the default instance of AdaptiveSourceManager which manages Smooth 
            //Streaming media sources.            
            //
            adaptiveSourceManager = AdaptiveSourceManager.GetDefault();

            // Sets property key value to AdaptiveSourceManager default instance.
            // {A5CE1DE8-1D00-427B-ACEF-FB9A3C93DE2D}" must be hardcoded.
            propertySet["{A5CE1DE8-1D00-427B-ACEF-FB9A3C93DE2D}"] = adaptiveSourceManager;

            // Registers Smooth Streaming byte-stream handler for “.ism” extension and, 
            // "text/xml" and "application/vnd.ms-ss" mime-types and pass the propertyset. 
            // http://*.ism/manifest URI resources will be resolved by Byte-stream handler.
            extensions.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism", "text/xml",
                propertySet);
            extensions.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism",
                "application/vnd.ms-ss", propertySet);
            extensions.RegisterSchemeHandler("Microsoft.Media.AdaptiveStreaming.SmoothSchemeHandler", "ms-sstr:", propertySet);

            //var vm = (IPlayFreeVideoViewModel)DataContext;

            //vm.AdaptiveSourceManager = adaptiveSourceManager;
            //vm.MediaElement = this.MediaElement;
        }
        public MainPage()
        {
            this.InitializeComponent();


            // Gets the default instance of AdaptiveSourceManager which manages Smooth Streaming media sources.
            adaptiveSourceManager = AdaptiveSourceManager.GetDefault();

            //Property sets are used to indicate what properties of an item or folder should be loaded when binding to an existing item or folder or when loading an item or folder's properties.
            // Sets property key value to AdaptiveSourceManager default instance.
            // {A5CE1DE8-1D00-427B-ACEF-FB9A3C93DE2D}" must be hardcoded.
            propertySet["{A5CE1DE8-1D00-427B-ACEF-FB9A3C93DE2D}"] = adaptiveSourceManager;
            //The MediaElement control does not support Smooth Streaming content out-of-box. To enable the Smooth Streaming support,
            //you must register the Smooth Streaming byte-stream handler by file name extension and MIME type. To register, you use the
            //MediaExtensionManager.RegisterByteStremHandler method of the Windows.Media namespace.


            // Registers Smooth Streaming byte-stream handler for ".ism" extension and,
            // "text/xml" and "application/vnd.ms-ss" mime-types and pass the propertyset.
            // http://*.ism/manifest URI resources will be resolved by Byte-stream handler.
            extensions.RegisterByteStreamHandler(
                "Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler",
                ".ism",
                "text/xml",
                propertySet);
            extensions.RegisterByteStreamHandler(
                "Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler",
                ".ism",
                "application/vnd.ms-sstr+xml",
                propertySet);
            //The source resolver takes a URL or byte stream and creates the appropriate media source for that content.
            //The source resolver is the standard way for the applications to create media sources.


            //subscribes to the adaptive source open event
            adaptiveSourceManager.AdaptiveSourceOpenedEvent += new AdaptiveSourceOpenedEventHandler(mediaElement_AdaptiveSourceOpened);
            //adaptiveSourceManager.AdaptiveSourceStatusUpdated += new AdaptiveSourceClosedEventHandler(mediaElement_AdaptiveSourceStatusUpdated);
            adaptiveSourceManager.AdaptiveSourceStatusUpdatedEvent += new AdaptiveSourceStatusUpdatedEventHandler(mediaElement_AdaptiveSourceStatusUpdated);
            adaptiveSourceManager.AdaptiveSourceStatusUpdatedEvent += adaptiveSourceManager_AdaptiveSourceStatusUpdatedEvent;
            //adaptiveSourceManager.AdaptiveSourceClosedEvent += new AdaptiveSourceClosedEventArgs(mediaElement_AdaptiveSourceClosed);

            //required to subscribe to the media element events
            mediaElement.MediaOpened += MediaOpened;
            mediaElement.MediaEnded  += MediaEnded;
            mediaElement.MediaFailed += MediaFailed;

            //code for the media player slider
            _dispatcher = Window.Current.Dispatcher;
            PointerEventHandler pointerpressedhandler = new PointerEventHandler(sliderProgress_PointerPressed);
            //sliderProgress.AddHandler(Control.PointerPressedEvent, pointerpressedhandler, true);
        }
Beispiel #3
0
        public MainPage()
        {
            this.InitializeComponent();

            // Gets the default instance of AdaptiveSourceManager which manages Smooth
            //Streaming media sources.
            adaptiveSourceManager = AdaptiveSourceManager.GetDefault();
            // Sets property key value to AdaptiveSourceManager default instance.
            // {A5CE1DE8-1D00-427B-ACEF-FB9A3C93DE2D}" must be hardcoded.
            propertySet["{A5CE1DE8-1D00-427B-ACEF-FB9A3C93DE2D}"] = adaptiveSourceManager;

            // Registers Smooth Streaming byte-stream handler for “.ism” extension and,
            // "text/xml" and "application/vnd.ms-ss" mime-types and pass the propertyset.
            // http://*.ism/manifest URI resources will be resolved by Byte-stream handler.
            extensions.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism", "text/xml", propertySet);
            extensions.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism", "application/vnd.ms-ss", propertySet);
            extensions.RegisterSchemeHandler("Microsoft.Media.AdaptiveStreaming.SmoothSchemeHandler", "ms-sstr:", propertySet);
        }
        public MainPage()
        {
            this.InitializeComponent();

            // Gets the default instance of AdaptiveSourceManager which manages Smooth 
            //Streaming media sources.
            adaptiveSourceManager = AdaptiveSourceManager.GetDefault();
            // Sets property key value to AdaptiveSourceManager default instance.
            // {A5CE1DE8-1D00-427B-ACEF-FB9A3C93DE2D}" must be hardcoded.
            propertySet["{A5CE1DE8-1D00-427B-ACEF-FB9A3C93DE2D}"] = adaptiveSourceManager;

            // Registers Smooth Streaming byte-stream handler for “.ism” extension and, 
            // "text/xml" and "application/vnd.ms-ss" mime-types and pass the propertyset. 
            // http://*.ism/manifest URI resources will be resolved by Byte-stream handler.
            extensions.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism", "text/xml", propertySet);
            extensions.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism", "application/vnd.ms-ss", propertySet);
            extensions.RegisterSchemeHandler("Microsoft.Media.AdaptiveStreaming.SmoothSchemeHandler", "ms-sstr:", propertySet);

        }
        void RegisterPlugins()
        {
            if (MediaManager == null)
            {
                MediaManager = new Windows.Media.MediaExtensionManager();
            }
            if (AdaptiveSrcManager == null)
            {
                AdaptiveSrcManager = AdaptiveSourceManager.GetDefault();
            }
            PropertySet ssps = new PropertySet();

            ssps["{A5CE1DE8-1D00-427B-ACEF-FB9A3C93DE2D}"] = AdaptiveSrcManager;


            MediaManager.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism", "text/xml", ssps);
            MediaManager.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism", "application/vnd.ms-sstr+xml", ssps);
            MediaManager.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".isml", "text/xml", ssps);
            MediaManager.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".isml", "application/vnd.ms-sstr+xml", ssps);
            MediaManager.RegisterSchemeHandler("Microsoft.Media.AdaptiveStreaming.SmoothSchemeHandler", "ms-sstr:", ssps);
        }