Parcourir la source

VideoSource: small changes

customisations
alemart il y a 1 an
Parent
révision
7169da1948
1 fichiers modifiés avec 8 ajouts et 2 suppressions
  1. 8
    2
      src/sources/video-source.ts

+ 8
- 2
src/sources/video-source.ts Voir le fichier

@@ -147,6 +147,8 @@ export class VideoSource implements Source
147 147
                     video.hidden = false;
148 148
                     video.style.setProperty('opacity', '0');
149 149
                     video.style.setProperty('position', 'absolute');
150
+                    //video.style.setProperty('display', 'none'); // doesn't work. Same as video.hidden
151
+                    //video.style.setProperty('visibility', 'hidden'); // doesn't work either
150 152
                 }
151 153
 
152 154
             }
@@ -174,7 +176,10 @@ export class VideoSource implements Source
174 176
             return Speedy.Promise.resolve(video);
175 177
 
176 178
         // videos marked with autoplay should be muted
177
-        video.muted = true;
179
+        if(!video.muted) {
180
+            Utils.warning('Videos marked with autoplay should be muted', video);
181
+            video.muted = true;
182
+        }
178 183
 
179 184
         // the browser may not honor the autoplay attribute if the video is not
180 185
         // visible on-screen. So, let's try to play the video in any case.
@@ -262,7 +267,8 @@ export class VideoSource implements Source
262 267
                     clearInterval(t);
263 268
                     resolve(video);
264 269
                 }
265
-                else if((ms += INTERVAL) > TIMEOUT) {
270
+                else if((ms += INTERVAL) >= TIMEOUT) {
271
+                    clearInterval(t);
266 272
                     reject(new TimeoutError('The video took too long to load'));
267 273
                 }
268 274
 

Chargement…
Annuler
Enregistrer