Multimedia
This topic describes how your application can play streaming and DRM-protected media content using TV-specific features in the Tizen.TV.Multimedia.Player class.
Related Info
You can implement streaming and DRM-protected media playback in your TV .NET application. For information on implementing basic media playback functionality, see Media Playback.
The Tizen.TV.Multimedia.Player
class is derived from the Tizen.Multimedia.Player class. In addition to the Tizen.Multimedia.Player
class features, you can implement adaptive streaming in the MPEG-DASH and Smooth Streaming formats, and play media protected using PlayReady DRM. For more information on the supported video formats, see Media Specifications > Video.
Within the Tizen.TV.Multimedia.Player
class, support for the Tizen.Multimedia.Player
class features has the following limitations:
- The following features are not supported and throw a "NotSupportedException" message:
CaptureVideoAsync()
methodApplyAudioStreamPolicy()
methodAudioEffect()
methodVideoFrameDecoded
event- If you use the
SetPlaybackRate()
method to set the playback rate to a value that is not 1.0, sound is muted. - The RTP/RTSP streaming protocol is not supported.
DRM-protected media playback is not supported on the TV emulator.
Prerequisites
To enable your application to use the TV-specific media playback functionalities:
-
Include the
Tizen.TV.Multimedia
namespace in your application:using Tizen.TV.Multimedia;
-
To play media from various sources using the Tizen.Multimedia.MediaUriSource class, the application has to request permission by adding the applicable privileges to the "tizen-manifest.xml" file:
<privileges> <!--To stream media from the network--> <privilege>http://tizen.org/privilege/internet</privilege> <!--To play media from internal storage--> <privilege>http://tizen.org/privilege/mediastorage</privilege> <!--To play media from external storage--> <privilege>http://tizen.org/privilege/externalstorage</privilege> </privileges>
-
To play DRM-protected content, the application has to request permission by adding the following privilege to the "tizen-manifest.xml" file:
<privileges> <privilege>http://developer.samsung.com/privilege/drmplay</privilege> </privileges>
Playing Streaming Media
To play MPEG-DASH or Smooth Streaming content:
-
Create and initialize the player using an instance of the
Tizen.TV.Multimedia.Player
class. -
To play the media, specify the stream URL as the media source:
player.Source = new MediaUriSource("http://somewhere.com/your_content");
Playing PlayReady-protected Content
To play content protected with PlayReady DRM:
-
Create and initialize the player using an instance of the
Tizen.TV.Multimedia.Player
class. -
Create an instance of the
DRMManager
class, and initialize it with theApplicationID
property of the Tizen.Applications.AppControl class:DRMManager drmMgr = DRMManager.CreateDRMManager(DRMType.Playready); drmMgr.Init($"applicationID");
-
To receive notifications, add event handlers to the appropriate events of the
Tizen.TV.Multimedia.Player
class. -
To play the media:
-
After setting the media source URL, configure the DRM properties.
Set the license server and media source URLs in theDRMManager
instance:String videoUrl = "http://somewhere.com/your_content"; String licenseServerUrl = "http://somewhere.com/your_license"; player.Source = new MediaUriSource(videoUrl); drmMgr.AddProperty("LicenseServer", licenseServerUrl); drmMgr.Url = videoUrl; drmMgr.Open();
-
Before preparing the player for playback, attach the
DRMManager
instance to the player:player.SetDrm(drmMgr); await player.PrepareAsync()
-
-
When you no longer need the player, you must release it and the
DRMManager
instance:player.Stop(); player.Unprepare(); player.Dispose(); drmMgr.Close(); drmMgr.Dispose();