Bug 262874 - Legacy EME WebKitMediaKeys createSessions unknown error
Summary: Legacy EME WebKitMediaKeys createSessions unknown error
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Audio (show other bugs)
Version: Safari 16
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Eric Carlson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-10-09 01:56 PDT by Geraint
Modified: 2024-03-04 12:46 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Geraint 2023-10-09 01:56:28 PDT
We are using a legacy implementation of FairPlay EME. When switching tracks to a previously played track in Safari we get WebKitMediaKeyError with code = 1  systemCode = 0.


Reproduction steps:
- Open Safari on macOS.
- Go to open.spotify.com
- Login with a Spotify account.
- Play any song or playlist.
- Use the Skip Forward and Skip Backwards buttons to go forwards and backwards alternately
(The buttons to the left & right of the play/pause button).
- After a few times going back and forth the error will occur.
A visible "Spotify can't play this right now." message will appear and an "Unhandled Promise Rejection: EMEError: MediaKeySession Safari Error" message will appear in the javascript console.


We create new WebKitMediaKeys, set the media keys via HTMLMediaElement.webkitSetMediaKeys, then call WebKitMediaKeys.createSession. We then wait the key added event but the key error event is fired instead.

Observations:
- It is not track specific, a track can play fine then can error out when coming back to it.
- It doesn't occur when attempting to play a track the first time.
- We have tried creating a new HTMLMediaElement & new media keys between tracks and we still get the error.
- Does not affect iOS. This works in Safari 14 macOS but not 16/17.
- Whether createSession is successful or not we call it (and WebKitMedia) with the same arguments
Comment 1 Radar WebKit Bug Importer 2023-10-09 10:58:49 PDT
<rdar://problem/116689080>
Comment 2 Eric Carlson 2024-02-29 18:42:23 PST
Pull request: https://github.com/WebKit/WebKit/pull/25333
Comment 3 EWS 2024-03-04 12:46:52 PST
Committed 275647@main (cac2e6433cf3): <https://commits.webkit.org/275647@main>

Reviewed commits have been landed. Closing PR #25333 and removing active labels.