Closed jorgitoml closed 8 years ago
Just use Player.play("http://playready.directtaps.net/smoothstreaming/SSWSS720H264/SuperSpeedway_720.ism/Manifest");
The main player body (buttons, progress bar, ellapsed/total time) is on you.
There are events called by Player:
To access them, just call Player.on('event', function(param) { ... do something });
And there are methods:
Please check the js/modules/player.js for all methods and events. Remember, that such stream works only on TV (and maybe on emulator). It will not work in standard Chrome, as it has no PlayReady support.
And one more hint - if you hear only sound and no video is visible, check if you haven't set body tag or some other element with background-color. The player DOM element is handled by TV and anything from application in DOM is above it. This mean it can be accidentally obscured by scene content. Also this must be handled by application - when starting player, all obscuring elements must be set to invisible, or backgrounds set to transparent.
Just a general comment: SmoothStreaming players on almost all TVs models as well as game consoles are on a quite good level. However since we are usually releasing applications for all 2012+ TV lines and it means support for large number of various TV models, we have faced on many project issues related to the video quality switching, support for multiple audio tracks, handling subtitles, etc. In such a case the best you can do is contacting TV vendors as usually it is a known player issue, which might be solved with FW update or you need to polish the format of the manifest file.
Tanks for the info. Can you tell me the procedure to set the DRM url and the custom data? Thanks again.
Preparation
// add DRM object to the DOM. You can place it in html or create id dynamically
var drm = '<object id="drmplugin" type="application/oipfDrmAgent" style="visibility:hidden" width="0" height="0"></object>';
$('body').append(drm);
var drmplugin = document.getElementById('drmplugin');
if (drmplugin) {
drmplugin.onDRMMessageResult = HandleOnDRMMessageResult;
drmplugin.onDRMRightsError = HandleOnDRMRightsError;
} else {
console.log('DRM Plugin initialization failed!');
return false;
}
Sending user data
var userData = {
"foo": "bar"
};
// send DRM message to DRM Agent with userData
var xmlSetCustomData = '<?xml version="1.0" encoding="utf-8"?>' +
'<PlayReadyInitiator xmlns="http://schemas.microsoft.com/DRM/2007/03/protocols/">' +
'<SetCustomData>' +
'<CustomData>'+window.btoa(JSON.stringify(userData))+'</CustomData>' +
'</SetCustomData>' +
'</PlayReadyInitiator>';
drmplugin.sendDRMMessage('application/vnd.ms-playready.initiator+xml', xmlSetCustomData, 'urn:dvb:casystemid:19219');
Handling response or error
function HandleOnDRMMessageResult(msgID, resultMsg, resultCode) {
if (resultCode == 0) {
// OK result received from PR server, we have license and we can start playback
Player.play("url");
}
}
function HandleOnDRMRightsError() {
console.log("HandleOnDRMRightsError");
}
The user data format is defined by the DRM service. Mostly it is a stringified JSON with user session, asset ID, ... converted to base64, but it might be a base64 string that comes from some API, or static string like on https://playready.directtaps.net/pr/doc/customrights/
And if I need to change the license server URL?
In Samsung Orsay devices I use: this.plugin.SetPlayerProperty(4, license_url, license_url.length);
In Samsung Tizen: drmParam = { LicenseServer: licenseServer, DeleteLicenseAfterUse: true, CustomData: customData }; webapis.avplay.setDrm("PLAYREADY", "SetProperties", JSON.stringify(drmParam));
In LG Netcast: sendLicenseRequest: function(global_licenseURL, b64_custom_data){
var msgType = "application/vnd.ms-playready.initiator+xml";
var xmlLicenseAcquisition = '<?xml version="1.0" encoding="utf-8"?>' +
'<PlayReadyInitiator xmlns="http://schemas.microsoft.com/DRM/2007/03/protocols/">' +
'<LicenseServerUriOverride>' +
'<LA_URL>'+global_licenseURL+'</LA_URL>' +
'</LicenseServerUriOverride>' +
'<SetCustomData>' +
'<CustomData>'+b64_custom_data+'</CustomData>' +
'</SetCustomData>' +
'</PlayReadyInitiator>';
var DRMSysID = "urn:dvb:casystemid:19219";
var oipfDrm = document.getElementById('oipfDrm');
oipfDrm.onDRMMessageResult = videoPlayer_live.HandleOnDRMMessageResult;
oipfDrm.sendDRMMessage(msgType, xmlLicenseAcquisition, DRMSysID);
console.log("after sendDRMMessage");
},
ETC
Regards.
and none of them work?
Yes, they work fine when I develop apps using each TV manufacturer SDK. Using your SDK I don't know how to change the license URL.
PS: The above examples are using the manufacturers SDK, not yours.
One more thing, Your example code is like the code I usually use in LG Netcast devices. It will work in all other manufacturer devices? (LG, Samsung, Philips, Sony, etc)
Yes, my code is for LG NetCast, but this works also on devices like Toshiba and Vestel/Gogen. Sadly, I have no experiences with PlayReady on Samsung devices, but hope one of my colleagues will answer.
If you need to send CustomData and LA_URL, you have to send it one by one:
// send DRM message to DRM Agent with userData
var xmlSetCustomData = '<?xml version="1.0" encoding="utf-8"?>' +
'<PlayReadyInitiator xmlns="http://schemas.microsoft.com/DRM/2007/03/protocols/">' +
'<SetCustomData>' +
'<CustomData>'+window.btoa(JSON.stringify(userData))+'</CustomData>' +
'</SetCustomData>' +
'</PlayReadyInitiator>';
this.drmplugin.sendDRMMessage('application/vnd.ms-playready.initiator+xml', xmlSetCustomData, 'urn:dvb:casystemid:19219');
and
// send DRM message to DRM Agent with LA_URL
var xmlLicenseServerUriOverride = '<?xml version="1.0" encoding="utf-8"?>' +
'<PlayReadyInitiator xmlns="http://schemas.microsoft.com/DRM/2007/03/protocols/">' +
'<LicenseServerUriOverride>'+
'<LA_URL>'+drmUrl+'</LA_URL>'+
'</LicenseServerUriOverride>'+
'</PlayReadyInitiator>';
this.drmplugin.sendDRMMessage('application/vnd.ms-playready.initiator+xml', xmlLicenseServerUriOverride, 'urn:dvb:casystemid:19219');
Then, you must then wait for 2 OK results in
HandleOnDRMMessageResult: function(msgID, resultMsg, resultCode) { ... }
Tx SoCoxx, let's wait to your colleagues.
I'm getting this error playing a Smootstreaming stream on Samsung TIzen:
PLAYER: PLAY developer.js:175 [Device_Tizen_Player] Event type: PLAYER_MSG_BITRATE_CHANGE developer.js:175 [Device_Tizen_Player] Error UNKNOWN_ERROR_EVENT_FROM_PLAYER, data: undefined developer.js:175 PLAYER: ERROR developer.js:175 Player ERROR 1: UNKNOWN_ERROR_EVENT_FROM_PLAYER developer.js:175 Player ERROR 2: undefined developer.js:175 Player ERROR 3: undefined
Same stream works fine in Samsung Orsay. Any clue?
Same stream works fine using the native Samsung Tizen SDK too.
@jorgitoml We do not have publicly available example.
OK, and any idea about the player error?
PLAYER: PLAY developer.js:175 [Device_Tizen_Player] Event type: PLAYER_MSG_BITRATE_CHANGE developer.js:175 Player Info >>> URL: http://XXXXXXXXXXX/LB-SVliveTr1/smil:119893_h.ism/Manifest Duration: 0 Current Bandwidth: 5771486 Audio tracks: [] developer.js:185 [Device_Tizen_Player] Error UNKNOWN_ERROR_EVENT_FROM_PLAYER, data: undefined developer.js:175 PLAYER: ERROR developer.js:175 Player ERROR 1: UNKNOWN_ERROR_EVENT_FROM_PLAYER developer.js:175 Player ERROR 2: undefined developer.js:175 Player ERROR 3: undefined
It says "UNKNOWN_ERROR_EVENT_FROM_PLAYER", so cannot even guess... The best what you can do is making the simple test application and sending it to us or to Samsung. If we find time we could check it.
I also suggest testing first the streams without DRM and once those will work start with the encryption.
Solved. There was a problem with the Tizen privileges. Thanks for all.
Hi jorgitoml,
I have similar issue to you, do you remember what kind of Tizen privileges were enabled by you?
Regards, Damian
Hope it helps:
`
<tizen:privilege name="http://developer.samsung.com/privilege/widgetdata"/>
<tizen:privilege name="http://developer.samsung.com/privilege/network.public"/>
<tizen:privilege name="http://tizen.org/privilege/tv.inputdevice"/>
<tizen:privilege name="http://tizen.org/privilege/application.info"/>
<tizen:privilege name="http://tizen.org/privilege/package.info"/>
<tizen:privilege name="http://developer.samsung.com/privilege/drminfo"/>
<tizen:privilege name="http://developer.samsung.com/privilege/drmplay"/>
<tizen:privilege name="http://developer.samsung.com/privilege/avplay"/>`
@jorgitoml it`s helped, thanks!
Hello, do you have any example of a player using a playready+smoothstreaming stream? Best regards.