笑故挽风 2014-02-04 01:39 采纳率: 100%
浏览 338

用AJAX加载VideoJS

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.

  • 写回答

1条回答 默认 最新

  • weixin_33724570 2014-02-04 16:20
    关注

    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().

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多
  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败