【问题标题】:Video JS not applying to new video elements视频 JS 不适用于新的视频元素
【发布时间】:2013-07-13 02:54:50
【问题描述】:

我正在构建一个带有选项卡式弹出窗口的网站,其中一个选项卡显示视频,其中显示与您选择的项目相关的信息。

但是,当您关闭该弹出窗口并打开另一个窗口时,视频显示为标准 HTML 5 播放器 - 没有视频 js 皮肤或 Flash 播放器。

每当加载弹出窗口时我都会加载它(以防万一 - 我从来没有习惯):

_V_("playa", {controls: true, autoplay: false, preload: "auto", techOrder: ["flash","html5"]}, function(){ });

当你在弹出窗口中选择一个新视频时,我有这个:

_V_("playa").ready(function(){
           var myPlayer = this;
            myPlayer.src(url);
            myPlayer.currentTime(0);
            myPlayer.play();
        });

当我在弹出窗口中更改选项卡时:

        _V_("playa").ready(function(){
          var myPlayer = this;
          myPlayer.pause();
        });

这是我真正引用播放器的唯一一次,但我被错误困扰。

如果我更改选项卡或不暂停就关闭,我会通过 Flash 播放器得到这个:

> ["Video.js: currentTime unavailable on Flash playback technology
> element.", TypeError]  video.js:20 Uncaught TypeError: Object
> #<HTMLObjectElement> has no method 'vjs_getProperty'

如果我使用 Video JS 的 HTML 5 播放器并尝试更改我得到的视频:

[DOMException, "Video is not ready. (Video.js)"]

请有人帮忙,我已经花了很长时间环顾四周,但似乎没有任何效果!我会永远爱你。

【问题讨论】:

    标签: html flash video video.js


    【解决方案1】:

    重置玩家变量:

    视频 JS 3.x

    _V_.players = {};
    

    视频 JS 4:

    videojs.players = {};
    

    【讨论】:

      【解决方案2】:

      如上所述here

      你应该运行myPlayer.dispose()

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-11-27
        • 2019-01-31
        • 1970-01-01
        • 2022-01-14
        • 1970-01-01
        • 1970-01-01
        • 2023-03-11
        • 1970-01-01
        相关资源
        最近更新 更多