Fix #1180: Fix broken media support detection

This commit is contained in:
Agate 2020-07-31 11:06:29 +02:00
parent 75f9537d89
commit c6e3ce1925
4 changed files with 16 additions and 4 deletions

View file

@ -342,13 +342,19 @@ export default {
},
getSources (uploads) {
let self = this;
let sources = uploads.map(u => {
let a = document.createElement('audio')
let allowed = ['probably', 'maybe']
let sources = uploads.filter(u => {
let canPlay = a.canPlayType(u.mimetype)
return allowed.indexOf(canPlay) > -1
}).map(u => {
return {
type: u.mimetype,
src: self.fullUrl(u.listen_url),
duration: u.duration
}
})
a.remove()
if (sources.length > 0) {
// We always add a transcoded MP3 src at the end
// because transcoding is expensive, but we want browsers that do