top

'Tizen::TV::Multimedia::DRMManager' class Reference
extends

Events

EventHandler< DRMOpenErrorEventArgs > DRMOpenErrorOccured
This event will be occured when drm session open is failed. More...

Properties

EventHandler< DRMLicenseRequestEventArgs > LicenseRequested
This event will be occured when the challenge data is posted from DRM. More...
DRMType Type
Get current drm type of DRMManager . More...
string Url
Url of DRM Contents. More...
string AppId
Gets the application identifier. More...
IntPtr DRMSession
Gets DRM session pointer object. More...

Public Functions

void Init ( string appId )
Initializes DRM session object with application identifier. More...
void Open ( )
Opens DRM session. More...
void AddProperty ( string propertyName, object propertyValue )
Adds a specific DRM property. You should set the appropriate property for each DRM to be a name-value pair in each case. More...
bool RemoveProperty ( string propertyName )
Removes the registered DRM property by property name. More...
void InstallLicense ( string license )
Installs challenge data to license server in GenChallenge case. More...
void Dispose ( )
Disposes DRMManager object. When Dispose() is called, the all DRM resources is released. More...
void Close ( )
Closes the current DRM session. More...

Public Static Functions

DRMManager CreateDRMManager ( DRMType type )
Create a new instance of the DRMManager class from the drm type. More...

Events

EventHandler< DRMOpenErrorEventArgs > DRMOpenErrorOccured

   This event will be occured when drm session open is failed.

Privilege Level

public

Privilege

http://developer.samsung.com/privilege/drmplay

Version

4.4.0

Properties

EventHandler< DRMLicenseRequestEventArgs > LicenseRequested

   This event will be occured when the challenge data is posted from DRM.

See

DRMManager.InstallLicense(string)

Privilege Level

public

Privilege

http://developer.samsung.com/privilege/drmplay

Version

4.4.0

DRMType Type

   Get current drm type of DRMManager .

Privilege Level

public

Privilege

http://developer.samsung.com/privilege/drmplay

Version

4.4.0

string Url

   Url of DRM Contents.

Remarks

   If you have DRMType set Playready, then you must set Url property.

Exceptions

ArgumentNullException
   The Url is null.

Privilege Level

public

Privilege

http://developer.samsung.com/privilege/drmplay

Version

4.4.0

string AppId

   Gets the application identifier.

Privilege Level

public

Privilege

http://developer.samsung.com/privilege/drmplay

Version

4.4.0

IntPtr DRMSession

   Gets DRM session pointer object.

Privilege Level

public

Privilege

http://developer.samsung.com/privilege/drmplay

Version

4.4.0

Public Functions

void Init(string appId)

   Initializes DRM session object with application identifier.

Parameters

appId
   Application Identifier.

Exceptions

InvalidOperationException
   When DRM session pointer creation is failed.
ArgumentNullException
   The appId is null.

Privilege Level

public

Privilege

http://developer.samsung.com/privilege/drmplay

Version

4.4.0

void Open()

   Opens DRM session.

Exceptions

InvalidOperationException
   When DRM session open is failed.

Privilege Level

public

Privilege

http://developer.samsung.com/privilege/drmplay

Version

4.4.0

void AddProperty(string propertyName, object propertyValue)

   Adds a specific DRM property. You should set the appropriate property for each DRM to be a name-value pair in each case.

Parameters

propertyName
   The name of property to be added.
propertyValue
   The value of property to be added.
/* When playing the playready contents using GetRights */
DRMManager dmgr = DRMManager.CreateDRMManager(DRMType.Playready);
dmgr.Init($"applicationID");
dmgr.Url = $"ContentsUrl";
dmgr.AddProperty("LicenseServer", $"LicenseServerUrl");
/* When playing the playready contents using GenChallenge */
DRMManager dmgr = DRMManager.CreateDRMManager(DRMType.Playready);
dmgr.Url = $"ContentsUrl";
dmgr.AddProperty("DeleteLicenseAfterUse", true);
dmgr.AddProperty("GetChallenge", true);
 

Exceptions

ArgumentNullException
   propertyName or proertyValue is null.
ArgumentException
   A property with the same property-name already exists in the DRM property

Privilege Level

public

Privilege

http://developer.samsung.com/privilege/drmplay

Version

4.4.0

bool RemoveProperty(string propertyName)

   Removes the registered DRM property by property name.

Parameters

propertyName
   The name of property to be removed.

Exceptions

ArgumentNullException
   The propertyName is null.

Returns

true if the property is successfully removed in the DRM property; otherwise, false.

Privilege Level

public

Privilege

http://developer.samsung.com/privilege/drmplay

Version

4.4.0

void InstallLicense(string license)

   Installs challenge data to license server in GenChallenge case.

Remarks

   If you need to install the license data directly with challenge data, you must register the property for Genchallenge case using DRMManager.AddProperty method and request license data to license server as sending challenge data. The challenge data will be posted from DRMManager.LicenseRequested event. You should convert Challenge Data from DRM to Base64 Decode string before requesting license data to server.

Parameters

license
   license string from license server
DRMManager dmgr = DRMManager.CreateDRMManager(DRMType.Playready);
dmgr.Init($"applicationID");
dmgr.Url = $"ContentsUrl";
/* register the property */
dmgr.AddProperty("DeleteLicenseAfterUse", true);
dmgr.AddProperty("GetChallenge", true);
/* register LicenseRequested event. */
dmgr.LicenseRequested += (s, e) =>
{
 Func<string, string> httpPost = param =>
 {
 WebRequest req = WebRequest.Create($"LicenseServerUrl");
 req.ContentType = "text/xml";
 req.Method = "POST";
 byte[] bytes = Encoding.ASCII.GetBytes(param);
 req.ContentLength = bytes.Length;
 using (Stream os = req.GetRequestStream())
 os.Write(bytes, 0, bytes.Length);
 return new StreamReader(req.GetResponse().GetResponseStream()).ReadToEnd().Trim();
 };
 string base64DecodedChallengeData = Encoding.ASCII.GetString(Convert.FromBase64String(e.ChallengeData));
 string licenseData = httpPost(base64DecodedChallengeData);
 dmgr.InstallLicense(licenseData);
};
dmgr.Open();
 

Exceptions

InvalidOperationException
   When InstallLicense is failed.
ArgumentNullException
   The license is null.

Privilege Level

public

Privilege

http://developer.samsung.com/privilege/drmplay

Version

4.4.0

void Dispose()

   Disposes DRMManager object. When Dispose() is called, the all DRM resources is released.

Privilege Level

public

Privilege

http://developer.samsung.com/privilege/drmplay

Version

4.4.0

void Close()

   Closes the current DRM session.

Exceptions

InvalidOperationException
   When Close DRM session is failed.

Privilege Level

public

Privilege

http://developer.samsung.com/privilege/drmplay

Version

4.4.0

Public Static Functions

DRMManager CreateDRMManager(DRMType type)

   Create a new instance of the DRMManager class from the drm type.

Parameters

type
   The type of drm.

Returns

New instance of DRMManager class

Exceptions

ArgumentException
   Type is not valid type.

Privilege Level

public

Privilege

http://developer.samsung.com/privilege/drmplay

Version

4.4.0