Fix player playback (video never ends)
authorChocobozzz <me@florianbigard.com>
Tue, 28 Aug 2018 08:23:01 +0000 (10:23 +0200)
committerChocobozzz <me@florianbigard.com>
Tue, 28 Aug 2018 08:23:21 +0000 (10:23 +0200)
client/src/assets/player/peertube-chunk-store.ts
client/src/assets/player/peertube-player-local-storage.ts

index e14e31c0466c23285eb4f68d64a2b08b5d7e3e5a..767e468219b1bf9221200af8984a62cce6c31168 100644 (file)
@@ -118,7 +118,13 @@ export class PeertubeChunkStore extends EventEmitter {
 
     // IndexDB could be slow, use our memory index first
     const memoryChunk = this.memoryChunks[index]
-    if (memoryChunk === undefined) return cb(null, new Buffer(0))
+    if (memoryChunk === undefined) {
+      const err = new Error('Chunk not found')
+      err['notFound'] = true
+
+      return process.nextTick(() => cb(err))
+    }
+
     // Chunk in memory
     if (memoryChunk !== true) return cb(null, memoryChunk)
 
index 6882f68a604a5203dfc1fd48b5e3263bf542b32a..dac54c5a4d5f2f96499508e2b491017b8f98d265 100644 (file)
@@ -52,7 +52,6 @@ function getAverageBandwidthInStore () {
   return undefined
 }
 
-
 // ---------------------------------------------------------------------------
 
 export {