Add support for WMA and AIFF audio files #449, add remove orphan streams, clean up audio mime type logic

This commit is contained in:
advplyr 2022-04-16 12:37:10 -05:00
parent 6d823f4e42
commit 5d305c96ad
11 changed files with 75 additions and 29 deletions

View file

@ -19,7 +19,7 @@ export default class LocalPlayer extends EventEmitter {
this.playWhenReady = false
this.defaultPlaybackRate = 1
this.playableMimeTypes = {}
this.playableMimeTypes = []
this.initialize()
}
@ -46,11 +46,14 @@ export default class LocalPlayer extends EventEmitter {
this.player.addEventListener('loadedmetadata', this.evtLoadedMetadata.bind(this))
this.player.addEventListener('timeupdate', this.evtTimeupdate.bind(this))
var mimeTypes = ['audio/flac', 'audio/mpeg', 'audio/mp4', 'audio/ogg', 'audio/aac']
var mimeTypes = ['audio/flac', 'audio/mpeg', 'audio/mp4', 'audio/ogg', 'audio/aac', 'audio/x-ms-wma', 'audio/x-aiff']
var mimeTypeCanPlayMap = {}
mimeTypes.forEach((mt) => {
this.playableMimeTypes[mt] = this.player.canPlayType(mt)
var canPlay = this.player.canPlayType(mt)
mimeTypeCanPlayMap[mt] = canPlay
if (canPlay) this.playableMimeTypes.push(mt)
})
console.log(`[LocalPlayer] Supported mime types`, this.playableMimeTypes)
console.log(`[LocalPlayer] Supported mime types`, mimeTypeCanPlayMap, this.playableMimeTypes)
}
evtPlay() {