12

我正在编写一个新应用程序来向三星电视提供内容我正在使用应用程序框架和 avplay 播放器。

我们使用的内容是用 Mpeg-Dash 包裹的 H.264

我已遵循下面提供的文档

三星 PlayReady 文档

我在下面提供了一个playerWrapper

JSFiddle

var playerWrapper = {
    player: null,
    licenseServerURL : null,
    token : null,
    contentURL : null,
    duration: 0,
};

var playCallBack = {
oncurrentplaytime : function(time) { 
    playerWrapper.setCurTime(time);
    alert(window.debugStatement + 'current time: ' + time);
},
onresolutionchanged: function(width, height) { alert(window.debugStatement + 'resolution changed to width:' + width + ' height:' + height);},
onstreamcompleted: function() { alert(window.debugStatement + 'stream completed');},
onerror: function(error) { 
    console.log(JSON.stringify(error));
    alert(window.debugStatement + 'player error: ' + error);
}
};

var bufferingCallBack = {
onbufferingstart: function() {
    alert(window.debugStatement + 'buffering started');
    playerWrapper.setDuration();
},
onbufferingprogress: function(percent) { alert(window.debugStatement + 'buffering percent: ' + percent); },
onbufferingcomplete: function() { alert(window.debugStatement + 'buffering complete');}
};

playerWrapper.setContentURL = function(url){
playerWrapper.contentURL = url + '|COMPONENT=HAS';
// playerWrapper.contentURL = url + '|COMPONENT=WMDRM';
};

playerWrapper.setLicenserURL =  function(url){
playerWrapper.licenseServerURL = url;
playerWrapper.player.setPlayerProperty(4, playerWrapper.licenseServerURL, playerWrapper.licenseServerURL.length);
};

playerWrapper.setToken = function(token){
playerWrapper.token = token;
playerWrapper.player.setPlayerProperty(3, playerWrapper.token, playerWrapper.token.length);
};

playerWrapper.setCurTime = function(time){
alert(window.debugStatement + 'current time: ' +time);
};

playerWrapper.setWindow = function() {
playerWrapper.player.setDisplayRect({
    top: 58,
    left: 458,
    width: 472,
    height: 270
});
},

playerWrapper.configurePlayer = function(player){
alert(window.debugStatement + 'Setting AVPlayer ');
playerWrapper.player = player; 
playerWrapper.player.init({
    containerID: 'player_container',
    bufferingCallback: bufferingCallBack,
    playCallback: playCallBack,
    displayRect: {
        top: 0,
        left: 0,
        width: 1920,
        height: 1080
    },
    autoRatio: true,
});
};

playerWrapper.getPlayerError = function(error){
alert(window.debugStatement + 'AVPlayer FETCH ERROR');
};

playerWrapper.setDuration = function() {
currentDuration = Player.AVPlayer.getDuration();
alert(window.debugStatement + 'current duration: ' + currentDuration);
playerWrapper.duration = convertTime(currentDuration);
};

playerWrapper.play = function(){
try{
    playerWrapper.player.open(
        playerWrapper.contentURL,
        {
            drm : {
                type : "Playready",
                company : 'Microsoft Corporation',
                deviceID : '1'
            }
        });
    playerWrapper.player.play(playerWrapper.playSuccess,    playerWrapper.playError);
}catch(error){
    alert(window.debugStatement + 'play error: ' + error);
}

};

playerWrapper.playSuccess = function(){
alert(window.debugStatement + 'success');
};

playerWrapper.playError = function(error){
alert(window.debugStatement + 'play error: ' + error);
},

playerWrapper.init = function(){
try{
    webapis.avplay.getAVPlay(playerWrapper.configurePlayer,     playerWrapper.getPlayerError);
    if(typeof playerWrapper.player === 'undefined') throw 'player fetch failure';
    return playerWrapper;
}catch(error){
    alert(window.debugStatement + 'AVPlayer Initialisation ERROR: ' + error);
}
};

此类从主 app.js 文件初始化,该文件仅遵循此工作流程

  1. 调用 playerWrapper 初始化
  2. 设置许可证 url
  3. 设置内容网址
  4. 设置令牌
  5. 打电话玩

看来,当使用文档中描述的 PlayReady 插件或 SetPlayerProperty 方法时,电视不会调用许可证服务器。

查看播放器规格,我可以看到 Mpeg-Dash 和 H.264 都受支持。

播放器规格

我的问题是

  1. 我能做些什么来解决这个问题?
  2. 有没有人看过这个错误的文档,好像我至少可以得到一个起点?
4

0 回答 0