如何替换现有剑道媒体播放器中的值

时间:2019-05-17 01:21:47

标签: kendo-ui

我正在使用kendoMediaPlayer,初始输出可以正常播放,但是我需要对其进行更新并上传另一个视频

我试图先摧毁,但没有成功:

$("#mediaplayer").data("kendoMediaPlayer").destroy();
$("#mediaplayer").kendoMediaPlayer({
                autoPlay: true,
                navigatable: true,
                media: {
                    title: title,
                    source: (path)
                }
            });

我收到此错误:

kendo.all.js:204318 Uncaught TypeError: Cannot read property 
'removeClass' of undefined
    at init._playStateToggle (kendo.all.js:204318)
    at init.stop (kendo.all.js:204318)
    at init._setPlayerUrl (kendo.all.js:204318)
    at init.media (kendo.all.js:204318)
    at new init (kendo.all.js:204318)
    at HTMLDivElement.<anonymous> (kendo.all.js:204318)
    at Function.each (jquery.min.js:2)
    at n.fn.init.each (jquery.min.js:2)
    at n.fn.init.e.fn.<computed> [as kendoMediaPlayer] 
(kendo.all.js:204318)
    at PlayVideo (eval at <anonymous> (jquery.min.js:1), <anonymous>:71:31)

1 个答案:

答案 0 :(得分:0)

if(!$("#mediaplayer").data("kendoMediaPlayer")){
$("#mediaplayer").kendoMediaPlayer({
                autoPlay: true,
                navigatable: true,
                media: {
                    title: title,
                    source: (path)
                }
            });

}
else{
var player = $("#mediaplayer").data("kendoMediaPlayer");
                player.media({
                    title: title,
                    source: (path)
                });
                player.play();
}