Пример #1
0
 public void EnsureMediaExtensionManager()
 {
     if (mediaExtensionMgr == null)
     {
         mediaExtensionMgr = new MediaExtensionManager();
         mediaExtensionMgr.RegisterSchemeHandler("Microsoft.Samples.SimpleCommunication.StspSchemeHandler", "stsp:");
     }
 }
Пример #2
0
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            this.InitializeComponent();
            MediaExtensionManager m = new MediaExtensionManager();

            m.RegisterSchemeHandler("ARDrone2Video.ARDroneSchemeHandler", "ardrone:");

            this.Suspending += OnSuspending;
        }
Пример #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);
        }
        /// <summary>
        /// Registers element for current media stream source
        /// </summary>
        /// <param name="element"></param>
        private void RegisterWith(MediaElement element)
        {
            if (_extensionManager != null)
            {
                throw new InvalidOperationException("MediaStreamSource is already registered with a media element.");
            }

            _extensionManager = new MediaExtensionManager();
            var config = new Windows.Foundation.Collections.PropertySet();

            // Registration of the scheme handler is global, so we need to get unique scheme so our
            // plugin will be used only for our this one instance of media element.
            string uri = "samplemss-" + element.GetHashCode() + ":";

            config.Add("plugin", new MMSWinRTPlugin(this));
            _extensionManager.RegisterSchemeHandler("MSSWinRTExtension.MediaStreamSchemeHandler", uri, config);

            element.Source = new Uri(uri);
        }
Пример #5
0
 public MainPage()
 {
     this.InitializeComponent();
     m_isPlaying = false;
     // TODO: Move this to the Initialization Routine once a connection is established
     // aka move it to "StartCamera" in here... (now it is started and sets up everything at the beginning with fixed parameters
     try
     {
         Uri pathUri = new Uri("vizario://square");
         MediaExtensionManager manager = new MediaExtensionManager();
         manager.RegisterSchemeHandler("Vizario.MediaSource.VizarioSchemeHandler", "vizario:");
         mediaSimple.Source = MediaSource.CreateFromUri(pathUri);
         mediaSimple.MediaPlayer.Play();
     }
     catch (Exception ex)
     {
         if (ex is FormatException)
         {
             // handle exception.
             // For example: Log error or notify user problem with file
         }
     }
 }
Пример #6
0
 public void RegisterSchemeHandler(string scheme)
 {
     MediaExtensionManager.RegisterSchemeHandler("Microsoft.Media.AdaptiveStreaming.SmoothSchemeHandler", scheme, propertySet);
 }