Преглед на файлове

Change the logic of VideoSource._waitUntilPlayable()

customisations
alemart преди 1 година
родител
ревизия
6287355cd6
променени са 1 файла, в които са добавени 4 реда и са изтрити 3 реда
  1. 4
    3
      src/sources/video-source.ts

+ 4
- 3
src/sources/video-source.ts Целия файл

@@ -256,19 +256,20 @@ export class VideoSource implements Source
256 256
     /**
257 257
      * Wait for the input video to be playable
258 258
      * @param video
259
-     * @returns a promise that resolves to the input video when it can be played through to the end
259
+     * @returns a promise that resolves to the input video when it can be played
260 260
      */
261 261
     private _waitUntilPlayable(video: HTMLVideoElement): SpeedyPromise<HTMLVideoElement>
262 262
     {
263 263
         const TIMEOUT = 15000, INTERVAL = 500;
264 264
 
265
-        if(video.readyState >= 4)
265
+        if(video.readyState >= 3)
266 266
             return Speedy.Promise.resolve(video);
267 267
 
268 268
         return new Speedy.Promise<HTMLVideoElement>((resolve, reject) => {
269 269
             let ms = 0, t = setInterval(() => {
270 270
 
271
-                if(video.readyState >= 4) { // canplaythrough
271
+                //if(video.readyState >= 4) { // canplaythrough (may timeout on slow connections)
272
+                if(video.readyState >= 3) {
272 273
                     clearInterval(t);
273 274
                     resolve(video);
274 275
                 }

Loading…
Отказ
Запис