mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	Fix:Stream url format issues
This commit is contained in:
		
							parent
							
								
									74d5174cfc
								
							
						
					
					
						commit
						d2c6f1bab1
					
				@ -14,6 +14,6 @@ export default class AudioTrack {
 | 
				
			|||||||
    if (process.env.NODE_ENV === 'development') {
 | 
					    if (process.env.NODE_ENV === 'development') {
 | 
				
			||||||
      return `${process.env.serverUrl}${this.contentUrl}`
 | 
					      return `${process.env.serverUrl}${this.contentUrl}`
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return `${window.location.origin}/${this.contentUrl}`
 | 
					    return `${window.location.origin}${this.contentUrl}`
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -78,7 +78,7 @@ export default class CastPlayer extends EventEmitter {
 | 
				
			|||||||
    if (process.env.NODE_ENV === 'development') {
 | 
					    if (process.env.NODE_ENV === 'development') {
 | 
				
			||||||
      this.coverUrl = coverImg
 | 
					      this.coverUrl = coverImg
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      this.coverUrl = `${window.location.origin}/${coverImg}`
 | 
					      this.coverUrl = `${window.location.origin}${coverImg}`
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var request = buildCastLoadRequest(this.audiobook, this.coverUrl, this.audioTracks, this.currentTime, playWhenReady, this.defaultPlaybackRate)
 | 
					    var request = buildCastLoadRequest(this.audiobook, this.coverUrl, this.audioTracks, this.currentTime, playWhenReady, this.defaultPlaybackRate)
 | 
				
			||||||
 | 
				
			|||||||
@ -99,7 +99,7 @@ export default class LocalPlayer extends EventEmitter {
 | 
				
			|||||||
    if (!Hls.isSupported()) {
 | 
					    if (!Hls.isSupported()) {
 | 
				
			||||||
      console.warn('HLS is not supported - fallback to using audio element')
 | 
					      console.warn('HLS is not supported - fallback to using audio element')
 | 
				
			||||||
      this.usingNativeplayer = true
 | 
					      this.usingNativeplayer = true
 | 
				
			||||||
      this.player.src = this.currentTrack.fullContentUrl
 | 
					      this.player.src = this.currentTrack.contentUrl
 | 
				
			||||||
      this.player.currentTime = this.currentTime
 | 
					      this.player.currentTime = this.currentTime
 | 
				
			||||||
      return
 | 
					      return
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -115,7 +115,7 @@ export default class LocalPlayer extends EventEmitter {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    this.hlsInstance.attachMedia(this.player)
 | 
					    this.hlsInstance.attachMedia(this.player)
 | 
				
			||||||
    this.hlsInstance.on(Hls.Events.MEDIA_ATTACHED, () => {
 | 
					    this.hlsInstance.on(Hls.Events.MEDIA_ATTACHED, () => {
 | 
				
			||||||
      this.hlsInstance.loadSource(this.currentTrack.fullContentUrl)
 | 
					      this.hlsInstance.loadSource(this.currentTrack.contentUrl)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      this.hlsInstance.on(Hls.Events.MANIFEST_PARSED, () => {
 | 
					      this.hlsInstance.on(Hls.Events.MANIFEST_PARSED, () => {
 | 
				
			||||||
        console.log('[HLS] Manifest Parsed')
 | 
					        console.log('[HLS] Manifest Parsed')
 | 
				
			||||||
 | 
				
			|||||||
@ -5,7 +5,7 @@ export default (ctx) => {
 | 
				
			|||||||
      return data.results.filter((b) => b.book.cover).map((ab) => {
 | 
					      return data.results.filter((b) => b.book.cover).map((ab) => {
 | 
				
			||||||
        var coverUrl = ctx.$store.getters['audiobooks/getBookCoverSrc'](ab)
 | 
					        var coverUrl = ctx.$store.getters['audiobooks/getBookCoverSrc'](ab)
 | 
				
			||||||
        if (process.env.NODE_ENV === 'development') return coverUrl
 | 
					        if (process.env.NODE_ENV === 'development') return coverUrl
 | 
				
			||||||
        return `${window.location.origin}/${coverUrl}`
 | 
					        return `${window.location.origin}${coverUrl}`
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    }).catch((error) => {
 | 
					    }).catch((error) => {
 | 
				
			||||||
      console.error('failed to fetch books', error)
 | 
					      console.error('failed to fetch books', error)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user