【问题标题】:video js error: Maximum call stack size exceeded视频js错误:超出最大调用堆栈大小
【发布时间】:2016-11-10 19:03:21
【问题描述】:

我正在使用videojsdailymotion.js 播放dailymotion 的视频。我还使用videojs.thumbnails.js 来显示缩略图。但是这么简单的代码在video.js中产生了一个奇怪的错误:

未捕获的 RangeError:超出最大调用堆栈大小

<!doctype html>
<html>
<head>
  <title>Video.js Thumbnails Example</title>
  <link href="http://vjs.zencdn.net/4.3/video-js.css" rel="stylesheet">
  <link href="videojs.thumbnails.css" rel="stylesheet">
  <script src="http://vjs.zencdn.net/4.3/video.js"></script>
  <script src='videojs.thumbnails.js'></script>
  <script src='dailymotion.js'></script>
</head>
<body>

<video id='video'
       class='video-js vjs-default-skin'
       width='640'
       height='264'
       controls> 
</video>
<script>
// initialize video.js
var video = videojs('video',{ "techOrder": ["dailymotion","html5"], "src": "https://www.dailymotion.com/embed/video/x378j01"});

// here's an example of generating thumbnails from a sprited image: 
video.thumbnails({
  0: {
    src: 'example-thumbnail.png'
  }
});

</script>
</body>
</html>

控制台中的错误是:

未捕获的 RangeError:超出最大调用堆栈大小

t.sc@video.js:47

t.duration@video.js:49

t.sc@video.js:47

t.duration@video.js:49

...

这似乎是一个循环,但我不知道它来自哪里,有什么想法吗?谢谢。

【问题讨论】:

    标签: javascript thumbnails video.js


    【解决方案1】:

    你需要在页面加载后放置videojs代码。试试这个

    $(function(){
    var video = videojs('video',{ "techOrder": ["dailymotion","html5"], "src": "https://www.dailymotion.com/embed/video/x378j01"});
    
    // here's an example of generating thumbnails from a sprited image: 
    video.thumbnails({
      0: {
        src: 'example-thumbnail.png'
      }
    });
    });
    

    【讨论】:

    • 你需要将jquey文件放在页面上,然后它才能工作。
    • 如果它仍然给出错误共享控制台登录评论。
    • 我尝试使用 video-js 5.0,它可以工作,但不适用于 video-js 4.3,这让我很困扰,因为我有一些与 5.0 版本不兼容的插件...
    猜你喜欢
    • 2013-08-19
    • 2011-08-31
    • 1970-01-01
    • 2021-02-05
    • 2019-07-19
    • 1970-01-01
    • 1970-01-01
    • 2016-12-10
    • 1970-01-01
    相关资源
    最近更新 更多