Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • funkwhale/funkwhale
  • Luclu7/funkwhale
  • mbothorel/funkwhale
  • EorlBruder/funkwhale
  • tcit/funkwhale
  • JocelynDelalande/funkwhale
  • eneiluj/funkwhale
  • reg/funkwhale
  • ButterflyOfFire/funkwhale
  • m4sk1n/funkwhale
  • wxcafe/funkwhale
  • andybalaam/funkwhale
  • jcgruenhage/funkwhale
  • pblayo/funkwhale
  • joshuaboniface/funkwhale
  • n3ddy/funkwhale
  • gegeweb/funkwhale
  • tohojo/funkwhale
  • emillumine/funkwhale
  • Te-k/funkwhale
  • asaintgenis/funkwhale
  • anoadragon453/funkwhale
  • Sakada/funkwhale
  • ilianaw/funkwhale
  • l4p1n/funkwhale
  • pnizet/funkwhale
  • dante383/funkwhale
  • interfect/funkwhale
  • akhardya/funkwhale
  • svfusion/funkwhale
  • noplanman/funkwhale
  • nykopol/funkwhale
  • roipoussiere/funkwhale
  • Von/funkwhale
  • aurieh/funkwhale
  • icaria36/funkwhale
  • floreal/funkwhale
  • paulwalko/funkwhale
  • comradekingu/funkwhale
  • FurryJulie/funkwhale
  • Legolars99/funkwhale
  • Vierkantor/funkwhale
  • zachhats/funkwhale
  • heyjake/funkwhale
  • sn0w/funkwhale
  • jvoisin/funkwhale
  • gordon/funkwhale
  • Alexander/funkwhale
  • bignose/funkwhale
  • qasim.ali/funkwhale
  • fakegit/funkwhale
  • Kxze/funkwhale
  • stenstad/funkwhale
  • creak/funkwhale
  • Kaze/funkwhale
  • Tixie/funkwhale
  • IISergII/funkwhale
  • lfuelling/funkwhale
  • nhaddag/funkwhale
  • yoasif/funkwhale
  • ifischer/funkwhale
  • keslerm/funkwhale
  • flupe/funkwhale
  • petitminion/funkwhale
  • ariasuni/funkwhale
  • ollie/funkwhale
  • ngaumont/funkwhale
  • techknowlogick/funkwhale
  • Shleeble/funkwhale
  • theflyingfrog/funkwhale
  • jonatron/funkwhale
  • neobrain/funkwhale
  • eorn/funkwhale
  • KokaKiwi/funkwhale
  • u1-liquid/funkwhale
  • marzzzello/funkwhale
  • sirenwatcher/funkwhale
  • newer027/funkwhale
  • codl/funkwhale
  • Zwordi/funkwhale
  • gisforgabriel/funkwhale
  • iuriatan/funkwhale
  • simon/funkwhale
  • bheesham/funkwhale
  • zeoses/funkwhale
  • accraze/funkwhale
  • meliurwen/funkwhale
  • divadsn/funkwhale
  • Etua/funkwhale
  • sdrik/funkwhale
  • Soran/funkwhale
  • kuba-orlik/funkwhale
  • cristianvogel/funkwhale
  • Forceu/funkwhale
  • jeff/funkwhale
  • der_scheibenhacker/funkwhale
  • owlnical/funkwhale
  • jovuit/funkwhale
  • SilverFox15/funkwhale
  • phw/funkwhale
  • mayhem/funkwhale
  • sridhar/funkwhale
  • stromlin/funkwhale
  • rrrnld/funkwhale
  • nitaibezerra/funkwhale
  • jaller94/funkwhale
  • pcouy/funkwhale
  • eduxstad/funkwhale
  • codingHahn/funkwhale
  • captain/funkwhale
  • polyedre/funkwhale
  • leishenailong/funkwhale
  • ccritter/funkwhale
  • lnceballosz/funkwhale
  • fpiesche/funkwhale
  • Fanyx/funkwhale
  • markusblogde/funkwhale
  • Firobe/funkwhale
  • devilcius/funkwhale
  • freaktechnik/funkwhale
  • blopware/funkwhale
  • cone/funkwhale
  • thanksd/funkwhale
  • vachan-maker/funkwhale
  • bbenti/funkwhale
  • tarator/funkwhale
  • prplecake/funkwhale
  • DMarzal/funkwhale
  • lullis/funkwhale
  • hanacgr/funkwhale
  • albjeremias/funkwhale
  • xeruf/funkwhale
  • llelite/funkwhale
  • RoiArthurB/funkwhale
  • cloo/funkwhale
  • nztvar/funkwhale
  • Keunes/funkwhale
  • petitminion/funkwhale-petitminion
  • m-idler/funkwhale
  • SkyLeite/funkwhale
140 results
Select Git revision
Show changes
...@@ -418,10 +418,12 @@ def handle_serve(upload, user, format=None, max_bitrate=None, proxy_media=True): ...@@ -418,10 +418,12 @@ def handle_serve(upload, user, format=None, max_bitrate=None, proxy_media=True):
response = Response(status=302) response = Response(status=302)
response["Location"] = f.audio_file.url response["Location"] = f.audio_file.url
return response return response
if mt: if mt:
response = Response(content_type=mt) # we need a non-empty response otherwise rest_framework removes our content-type
response = Response(b"noop", content_type=mt)
else: else:
response = Response() response = Response(b"noop")
filename = f.filename filename = f.filename
mapping = {"nginx": "X-Accel-Redirect", "apache2": "X-Sendfile"} mapping = {"nginx": "X-Accel-Redirect", "apache2": "X-Sendfile"}
file_header = mapping[settings.REVERSE_PROXY_TYPE] file_header = mapping[settings.REVERSE_PROXY_TYPE]
......
...@@ -451,13 +451,16 @@ def test_handle_serve_create_mp3_version(factories, now): ...@@ -451,13 +451,16 @@ def test_handle_serve_create_mp3_version(factories, now):
def test_listen_transcode(factories, now, logged_in_api_client, mocker, settings): def test_listen_transcode(factories, now, logged_in_api_client, mocker, settings):
upload = factories["music.Upload"]( upload = factories["music.Upload"](
import_status="finished", library__actor__user=logged_in_api_client.user import_status="finished",
library__actor__user=logged_in_api_client.user,
mimetype="audio/mpeg",
) )
url = reverse("api:v1:listen-detail", kwargs={"uuid": upload.track.uuid}) url = reverse("api:v1:listen-detail", kwargs={"uuid": upload.track.uuid})
handle_serve = mocker.spy(views, "handle_serve") handle_serve = mocker.spy(views, "handle_serve")
response = logged_in_api_client.get(url, {"to": "mp3"}) response = logged_in_api_client.get(url, {"to": "mp3"})
assert response.status_code == 200 assert response.status_code == 200
assert response["Content-Type"] == "audio/mpeg"
handle_serve.assert_called_once_with( handle_serve.assert_called_once_with(
upload, upload,
......
Fallback to next available format when browser fails to decode audio (#925)
...@@ -262,7 +262,7 @@ export default { ...@@ -262,7 +262,7 @@ export default {
sourceErrors: 0, sourceErrors: 0,
progressInterval: null, progressInterval: null,
maxPreloaded: 3, maxPreloaded: 3,
preloadDelay: 15, preloadDelay: 5,
soundsCache: [], soundsCache: [],
soundId: null, soundId: null,
playTimeout: null, playTimeout: null,
...@@ -374,12 +374,18 @@ export default { ...@@ -374,12 +374,18 @@ export default {
this.$store.commit("player/isLoadingAudio", false) this.$store.commit("player/isLoadingAudio", false)
this.$store.dispatch("player/trackErrored") this.$store.dispatch("player/trackErrored")
}, },
getSound (trackData) { getSound (trackData, skippedFormats = []) {
let cached = this.getSoundFromCache(trackData) let cached = this.getSoundFromCache(trackData)
if (cached) { if (cached) {
return cached.sound return cached.sound
} }
let srcs = this.getSrcs(trackData) let srcs = this.getSrcs(trackData).filter((s) => {
return skippedFormats.indexOf(s.type) === -1
})
let srcsByUrl = {}
srcs.forEach(s => {
srcsByUrl[s.url] = s
})
let self = this let self = this
let sound = new Howl({ let sound = new Howl({
src: srcs.map((s) => { return s.url }), src: srcs.map((s) => { return s.url }),
...@@ -413,12 +419,23 @@ export default { ...@@ -413,12 +419,23 @@ export default {
self.$store.commit('player/errored', false) self.$store.commit('player/errored', false)
self.$store.commit('player/duration', this.duration()) self.$store.commit('player/duration', this.duration())
}, },
onloaderror: function (sound, error) { onloaderror: async function (sound, error) {
self.removeFromCache(this) self.removeFromCache(this)
if (this != self.currentSound) { if (this != self.currentSound) {
return return
} }
if (error === 4) {
console.log('Error while decoding:', sound, error)
if (skippedFormats.length === 0 && srcs.length > 1) {
skippedFormats.push(srcs[0].type)
console.log(`Playing ${srcs[0].type} failed, loading next format ${srcs[1].type}`)
await self.loadSound(trackData, null, skippedFormats)
console.log('Replacing current sound with alternative format')
return
}
} else {
console.log('Error while playing:', sound, error) console.log('Error while playing:', sound, error)
}
self.handleError({sound, error}) self.handleError({sound, error})
}, },
}) })
...@@ -579,9 +596,11 @@ export default { ...@@ -579,9 +596,11 @@ export default {
if (toKeep.length < self.maxPreloaded) { if (toKeep.length < self.maxPreloaded) {
toKeep.push(e) toKeep.push(e)
} else { } else {
if (e.sound) {
let src = e.sound._src let src = e.sound._src
e.sound.unload() e.sound.unload()
} }
}
}) })
this.soundsCache = _.reverse(toKeep) this.soundsCache = _.reverse(toKeep)
}, },
...@@ -596,7 +615,7 @@ export default { ...@@ -596,7 +615,7 @@ export default {
}) })
this.soundsCache = toKeep this.soundsCache = toKeep
}, },
async loadSound (newValue, oldValue) { async loadSound (newValue, oldValue, skippedFormats = []) {
let trackData = newValue let trackData = newValue
let oldSound = this.currentSound let oldSound = this.currentSound
if (oldSound && trackData !== oldValue) { if (oldSound && trackData !== oldValue) {
...@@ -611,7 +630,7 @@ export default { ...@@ -611,7 +630,7 @@ export default {
if (trackData === null) { if (trackData === null) {
this.handleError({}) this.handleError({})
} }
this.currentSound = this.getSound(trackData) this.currentSound = this.getSound(trackData, skippedFormats)
this.$store.commit('player/isLoadingAudio', true) this.$store.commit('player/isLoadingAudio', true)
if (this.playing) { if (this.playing) {
this.soundId = this.currentSound.play() this.soundId = this.currentSound.play()
......