Greetings Fellow Humans,
My player uses the v3 musickit-js library. I am trying to handle situations where a user tries to play explicit content in my player with an account that has content restrictions enabled. I don't see a mechanism to know if the toggle is set in the account. The only mechanism I see is to respond to a CONTENT_RESTRICTED
error as handled by the callback to the function I provide as a callback to the mediaPlaybackError
event.
I have attached many callbacks (like bufferedProgressDidChange
) and those all work, but this one never fires.
music.addEventListener("mediaPlaybackError", onPlaybackError);
Or
music.addEventListener(MusicKit.Events.mediaPlaybackError, onPlaybackError);
My onPlaybackError
function, at least for debugging purposes, is:
function onPlaybackError(e) {
console.log("onPlaybackError");
console.log(e);
}
There are so many error conditions that are meant to be handled in this way but the callback never happens. Am I missing something? Why doesn't this callback fire?
Thanks!