浏览代码

Remove video canplay event, not triggered properly on Firefox

Jay Salvat 10 年之前
父节点
当前提交
4d313d9162
共有 4 个文件被更改,包括 8 次插入24 次删除
  1. 4 12
      dist/vegas.js
  2. 0 0
      dist/vegas.min.js
  3. 0 0
      dist/vegas.min.js.map
  4. 4 12
      src/vegas.js

+ 4 - 12
dist/vegas.js

@@ -265,7 +265,6 @@
             }
 
             video = document.createElement('video');
-            // video.muted = true;
             video.preload = true;
 
             srcs.forEach(function (src) {
@@ -483,21 +482,13 @@
                     self._slideShow();
                 }, 100);
             }
-
             if (video) {
                 if (video.readyState === 4) {
                     video.currentTime = 0;
-                    video.play();
-                    go();
-                } else {
-                    video.oncanplay = function () {
-                        video.play();
-                        if (!video._started) {
-                            video._started = true;
-                            go();
-                        }
-                    };
                 }
+                
+                video.play();
+                go();
             } else {
                 img.src = src;
                 img.onload = go;
@@ -511,6 +502,7 @@
             for (var i = this.total - 1; i > 0; i--) {
                 rand = Math.floor(Math.random() * (i + 1));
                 temp = this.settings.slides[i];
+
                 this.settings.slides[i] = this.settings.slides[rand];
                 this.settings.slides[rand] = temp;
             }

文件差异内容过多而无法显示
+ 0 - 0
dist/vegas.min.js


文件差异内容过多而无法显示
+ 0 - 0
dist/vegas.min.js.map


+ 4 - 12
src/vegas.js

@@ -256,7 +256,6 @@
             }
 
             video = document.createElement('video');
-            // video.muted = true;
             video.preload = true;
 
             srcs.forEach(function (src) {
@@ -474,21 +473,13 @@
                     self._slideShow();
                 }, 100);
             }
-
             if (video) {
                 if (video.readyState === 4) {
                     video.currentTime = 0;
-                    video.play();
-                    go();
-                } else {
-                    video.oncanplay = function () {
-                        video.play();
-                        if (!video._started) {
-                            video._started = true;
-                            go();
-                        }
-                    };
                 }
+                
+                video.play();
+                go();
             } else {
                 img.src = src;
                 img.onload = go;
@@ -502,6 +493,7 @@
             for (var i = this.total - 1; i > 0; i--) {
                 rand = Math.floor(Math.random() * (i + 1));
                 temp = this.settings.slides[i];
+
                 this.settings.slides[i] = this.settings.slides[rand];
                 this.settings.slides[rand] = temp;
             }

部分文件因为文件数量过多而无法显示