문제

I'm trying to load by AJAX a video working with VideoJS but I can't manage how to make it work after the AJAX load. I've been reading a lot about this but I couldn't find any solution.

I show you an example. You can check this link with a working video. And here I'm trying to load the previous link through an AJAX load.

This is the code I run after the AJAX call. You can check it also in the links I just entered.

_V_($('.video-container-large').find('.video-js')).ready(function(){
        var myPlayer = this;
        myPlayer.destroy();
        myPlayer.play();            
    });
    return false;
} );

Do you know why VideoJS is not initialized fine? I tried a lot of alternatives without any success, so any help will be much appreciated!

Thank you.

도움이 되었습니까?

해결책

The argument passed to _V_() (or videojs()) should be an element or an id, not a jquery object. Use array notation to get the element from the object.

videojs($('.video-container-large').find('.video-js')[0]).ready(function(){ …

Note: _V_() was deprecated in video.js 4 and removed in video.js 5. Use videojs().

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top