如何使用javascript动态添加videojs播放器?

如何使用javascript动态添加videojs播放器?,javascript,angularjs,video,video.js,Javascript,Angularjs,Video,Video.js,对这个问题的任何启发都会非常有帮助 我所要做的就是用javascript动态添加一个videojs播放器 <div class="video-wrapper" ng-repeat="videos in panel"> <button class="remove-video" ng-click="removeFromPanel($index)">x</button> <video id="{{videos.id}}" cla

对这个问题的任何启发都会非常有帮助

我所要做的就是用javascript动态添加一个videojs播放器

<div class="video-wrapper" ng-repeat="videos in panel">
        <button class="remove-video" ng-click="removeFromPanel($index)">x</button>
        <video id="{{videos.id}}" class="video-js vjs-default-skin" preload="none" controls width="300" height="210"
              poster="" >
              <source src="{{videos.directory}}" type='video/mp4' />
        </video>
    </div>
手动设置播放器,但没有成功

有人有这个问题并设法解决了吗

我很想为此做一个js提琴,但我的应用程序使用了angular,我永远无法使它在JSFIDLE中正常工作


感谢您的阅读和提前提供的帮助

我使用

myPlayer.dispose(); 
在播放器对象上,然后使用

_V_("player id", { "controls": true, "autoplay": false, "preload": "auto" }, function(){
    // Player (this) is initialized and ready.
    });
在dom中创建一个新的player对象后初始化它

所以我假设我的问题与对同一个player对象有两个引用有关

_V_("player id", { "controls": true, "autoplay": false, "preload": "auto" }, function(){
    // Player (this) is initialized and ready.
    });