MediaSession got broken #6

Open
opened 2025-01-31 21:36:09 +03:00 by gAlleb · 5 comments
gAlleb commented 2025-01-31 21:36:09 +03:00 (Migrated from github.com)

Somewhere along the way MediaSession stopped working.

Probably 720d65b03f is one of the last commits where we can see MediaSession.

Somewhere along the way MediaSession stopped working. Probably 720d65b03f6529cd2026b892d803a15dfdb2cf83 is one of the last commits where we can see MediaSession.
gAlleb commented 2025-02-01 09:16:07 +03:00 (Migrated from github.com)

Got it!

        if (this.ctx.state === 'suspended') {
          this.unlockAudioContext(this.ctx)
        }

This function somehow stops MediaSession. If I comment out it - MediaSession works.

@PeWe79 any thoughts on this?

Got it! ``` if (this.ctx.state === 'suspended') { this.unlockAudioContext(this.ctx) } ``` This function somehow stops MediaSession. If I comment out it - MediaSession works. @PeWe79 any thoughts on this?
gAlleb commented 2025-02-01 13:16:51 +03:00 (Migrated from github.com)

Yeah, the issue is that your function adds event listeners to the entire document.body. These listeners interfere with Media Session initialization. Hm..

Yeah, the issue is that your function adds event listeners to the entire document.body. These listeners interfere with Media Session initialization. Hm..
PeWe79 commented 2025-02-01 13:29:12 +03:00 (Migrated from github.com)

Hi @gAlleb , actualy cause AudioContext was mount premature (on initPlayer) was mount via app, so AudioContext was block. Other solution is AudioContext mount after "do something" may look click togglePlay or call initPlayer after togglePlay.

Hi @gAlleb , actualy cause AudioContext was mount premature (on initPlayer) was mount via app, so AudioContext was block. Other solution is AudioContext mount after "do something" may look click togglePlay or call initPlayer after togglePlay.
gAlleb commented 2025-02-01 13:46:20 +03:00 (Migrated from github.com)

oh, I see! Thank you!

oh, I see! Thank you!
gAlleb commented 2025-02-01 16:14:01 +03:00 (Migrated from github.com)

Hm, even if I call initPlayer on Button togglePlayAll or other one instead of onMounted hook - mediasession won't start either. AudioContext is not blocked anymore on Chrome but still no mediasession (at least on iOS).

So it's somehow mediasession doesn't like if AudioContext is started NOT onMounted. Because if we call initPlayer on event or resume AudioContext on event - mediasession doesn't start. And it's not connected to event listeners. Hm.

Hm, even if I call initPlayer on Button togglePlayAll or other one instead of onMounted hook - mediasession won't start either. AudioContext is not blocked anymore on Chrome but still no mediasession (at least on iOS). So it's somehow mediasession doesn't like if AudioContext is started NOT onMounted. Because if we call initPlayer on event or resume AudioContext on event - mediasession doesn't start. And it's not connected to event listeners. Hm.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
stefan/nuxt-om#6
No description provided.