mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-11-04 03:17:00 -05:00 
			
		
		
		
	
							parent
							
								
									630ece82ad
								
							
						
					
					
						commit
						88f9533b37
					
				
							
								
								
									
										8
									
								
								client/package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										8
									
								
								client/package-lock.json
									
									
									
										generated
									
									
									
								
							@ -16,7 +16,7 @@
 | 
				
			|||||||
        "cron-parser": "^4.7.1",
 | 
					        "cron-parser": "^4.7.1",
 | 
				
			||||||
        "date-fns": "^2.25.0",
 | 
					        "date-fns": "^2.25.0",
 | 
				
			||||||
        "epubjs": "^0.3.88",
 | 
					        "epubjs": "^0.3.88",
 | 
				
			||||||
        "hls.js": "^1.0.7",
 | 
					        "hls.js": "^1.5.7",
 | 
				
			||||||
        "libarchive.js": "^1.3.0",
 | 
					        "libarchive.js": "^1.3.0",
 | 
				
			||||||
        "nuxt": "^2.17.3",
 | 
					        "nuxt": "^2.17.3",
 | 
				
			||||||
        "nuxt-socket-io": "^1.1.18",
 | 
					        "nuxt-socket-io": "^1.1.18",
 | 
				
			||||||
@ -8627,9 +8627,9 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/hls.js": {
 | 
					    "node_modules/hls.js": {
 | 
				
			||||||
      "version": "1.5.1",
 | 
					      "version": "1.5.7",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/hls.js/-/hls.js-1.5.1.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/hls.js/-/hls.js-1.5.7.tgz",
 | 
				
			||||||
      "integrity": "sha512-SsUSlpyjOGnwBhVrVEG6vRFPU2SAJ0gUqrFdGeo7YPbOC0vuWK0TDMyp7n3QiaBC/Wkic771uqPnnVdT8/x+3Q=="
 | 
					      "integrity": "sha512-Hnyf7ojTBtXHeOW1/t6wCBJSiK1WpoKF9yg7juxldDx8u3iswrkPt2wbOA/1NiwU4j27DSIVoIEJRAhcdMef/A=="
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/hmac-drbg": {
 | 
					    "node_modules/hmac-drbg": {
 | 
				
			||||||
      "version": "1.0.1",
 | 
					      "version": "1.0.1",
 | 
				
			||||||
 | 
				
			|||||||
@ -21,7 +21,7 @@
 | 
				
			|||||||
    "cron-parser": "^4.7.1",
 | 
					    "cron-parser": "^4.7.1",
 | 
				
			||||||
    "date-fns": "^2.25.0",
 | 
					    "date-fns": "^2.25.0",
 | 
				
			||||||
    "epubjs": "^0.3.88",
 | 
					    "epubjs": "^0.3.88",
 | 
				
			||||||
    "hls.js": "^1.0.7",
 | 
					    "hls.js": "^1.5.7",
 | 
				
			||||||
    "libarchive.js": "^1.3.0",
 | 
					    "libarchive.js": "^1.3.0",
 | 
				
			||||||
    "nuxt": "^2.17.3",
 | 
					    "nuxt": "^2.17.3",
 | 
				
			||||||
    "nuxt-socket-io": "^1.1.18",
 | 
					    "nuxt-socket-io": "^1.1.18",
 | 
				
			||||||
 | 
				
			|||||||
@ -139,11 +139,30 @@ export default class LocalAudioPlayer extends EventEmitter {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var hlsOptions = {
 | 
					    var hlsOptions = {
 | 
				
			||||||
      startPosition: this.startTime || -1
 | 
					      startPosition: this.startTime || -1,
 | 
				
			||||||
      // No longer needed because token is put in a query string
 | 
					      fragLoadPolicy: {
 | 
				
			||||||
      // xhrSetup: (xhr) => {
 | 
					        default: {
 | 
				
			||||||
      //   xhr.setRequestHeader('Authorization', `Bearer ${this.token}`)
 | 
					          maxTimeToFirstByteMs: 10000,
 | 
				
			||||||
      // }
 | 
					          maxLoadTimeMs: 120000,
 | 
				
			||||||
 | 
					          timeoutRetry: {
 | 
				
			||||||
 | 
					            maxNumRetry: 4,
 | 
				
			||||||
 | 
					            retryDelayMs: 0,
 | 
				
			||||||
 | 
					            maxRetryDelayMs: 0,
 | 
				
			||||||
 | 
					          },
 | 
				
			||||||
 | 
					          errorRetry: {
 | 
				
			||||||
 | 
					            maxNumRetry: 8,
 | 
				
			||||||
 | 
					            retryDelayMs: 1000,
 | 
				
			||||||
 | 
					            maxRetryDelayMs: 8000,
 | 
				
			||||||
 | 
					            shouldRetry: (retryConfig, retryCount, isTimeout, httpStatus, retry) => {
 | 
				
			||||||
 | 
					              if (httpStatus?.code === 404 && retryConfig?.maxNumRetry > retryCount) {
 | 
				
			||||||
 | 
					                console.log(`[HLS] Server 404 for fragment retry ${retryCount} of ${retryConfig.maxNumRetry}`)
 | 
				
			||||||
 | 
					                return true
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					              return retry
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          },
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    this.hlsInstance = new Hls(hlsOptions)
 | 
					    this.hlsInstance = new Hls(hlsOptions)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -156,9 +175,15 @@ export default class LocalAudioPlayer extends EventEmitter {
 | 
				
			|||||||
      })
 | 
					      })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      this.hlsInstance.on(Hls.Events.ERROR, (e, data) => {
 | 
					      this.hlsInstance.on(Hls.Events.ERROR, (e, data) => {
 | 
				
			||||||
        console.error('[HLS] Error', data.type, data.details, data)
 | 
					 | 
				
			||||||
        if (data.details === Hls.ErrorDetails.BUFFER_STALLED_ERROR) {
 | 
					        if (data.details === Hls.ErrorDetails.BUFFER_STALLED_ERROR) {
 | 
				
			||||||
          console.error('[HLS] BUFFER STALLED ERROR')
 | 
					          console.error('[HLS] BUFFER STALLED ERROR')
 | 
				
			||||||
 | 
					        } else if (data.details === Hls.ErrorDetails.FRAG_LOAD_ERROR) {
 | 
				
			||||||
 | 
					          // Only show error if the fragment is not being retried
 | 
				
			||||||
 | 
					          if (data.errorAction?.action !== 5) {
 | 
				
			||||||
 | 
					            console.error('[HLS] FRAG LOAD ERROR', data)
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					          console.error('[HLS] Error', data.type, data.details, data)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
      this.hlsInstance.on(Hls.Events.DESTROYING, () => {
 | 
					      this.hlsInstance.on(Hls.Events.DESTROYING, () => {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user