The AdaptiveMediaSourceCreationStatus value returned from this method lets you know if the media source was created successfully. Initialize the AdaptiveMediaSource with the URI of an adaptive streaming manifest file by calling CreateFromUriAsync. Initialize an AdaptiveMediaSource from a URI. The examples in this article use APIs from the following namespaces. The adaptive streaming APIs are found in the namespace. If your app requires more advanced adaptive streaming features, such as providing custom HTTP headers, monitoring the current download and playback bitrates, or adjusting the ratios that determine when the system switches bitrates of the adaptive stream, use the AdaptiveMediaSource object. Adaptive streaming with AdaptiveMediaSource For information about using MediaSource and related APIs to work with media content, see Media items, playlists, and tracks. For more information about using MediaPlayer and MediaPlayerElement to play media content, see Play audio and video with MediaPlayer. The MediaElement control continues to be supported for backwards compatibility. The MediaPlayerElement is a lightweight XAML control that is used to render the content of a MediaPlayer in a XAML page. Starting with Windows 10, version 1607, it is recommended that you use the MediaPlayer class to play media items. MediaPlayerElement.Source = MediaSource.CreateFromUri(manifestUri) System.Uri manifestUri = new Uri("(format=m3u8-aapl)") You can call Play on the MediaPlayer to start playback of the content. The MediaPlayerElement will automatically create a new MediaPlayer object for the content. Then set the Source property of the MediaPlayerElement. Ĭall MediaSource.CreateFromUri to create a MediaSource from the URI of a DASH or HLS manifest file. To do this, add a MediaPlayerElement control to your XAML page. Most apps that play video content will want to render the content in a XAML page. The above example will play the audio of the media content but it doesn't automatically render the content in your UI. _mediaPlayer.Source = MediaSource.CreateFromUri(manifestUri) Call Play to start playback of the media content. Call MediaSource.CreateFromUri to create a new MediaSource object and then set that to the Source property of the MediaPlayer. Create an instance of the MediaPlayer class. To play adaptive streaming media in a UWP app, create a Uri object pointing to a DASH or HLS manifest file. Simple adaptive streaming with MediaPlayer and MediaPlayerElement The code in this article was adapted from the UWP Adaptive streaming sample.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |