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.

Prerequisites

To enable your application to use the TV-specific media playback functionalities:

  1. Include the Tizen.TV.Multimedia namespace in your application:

    using Tizen.TV.Multimedia;
    
  2. 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>
    
  3. 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:

  1. Create and initialize the player using an instance of the Tizen.TV.Multimedia.Player class.

  2. 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:

  1. Create and initialize the player using an instance of the Tizen.TV.Multimedia.Player class.

  2. Create an instance of the DRMManager class, and initialize it with the ApplicationID property of the Tizen.Applications.AppControl class:

    DRMManager drmMgr = DRMManager.CreateDRMManager(DRMType.Playready);
    drmMgr.Init($"applicationID");
    
  3. To receive notifications, add event handlers to the appropriate events of the Tizen.TV.Multimedia.Player class.

  4. To play the media:

    1. After setting the media source URL, configure the DRM properties.
      Set the license server and media source URLs in the DRMManager 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();
      
    2. Before preparing the player for playback, attach the DRMManager instance to the player:

      player.SetDrm(drmMgr);
      
      await player.PrepareAsync()
      
  5. 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();