We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://developer.mozilla.org/en-US/docs/Web/API/Media_Session_API
New standard for all modern devices.
sync controlers with device.
ex: iOS control center
`// https://stackoverflow.com/questions/73993512/web-audio-player-ios-next-song-previous-song-buttons-are-not-in-control-cent // https://developer.mozilla.org/en-US/docs/Web/API/MediaSession if ('mediaSession' in navigator) { var setMediaMetadata = function() { currentSong = Amplitude.getActiveSongMetadata(); navigator.mediaSession.metadata = new MediaMetadata({ title: currentSong.name, artist: currentSong.artist, album: currentSong.album, artwork: [{ src: currentSong.cover_art_url }] }); };
var audioElement = Amplitude.getAudio(); audioElement.addEventListener('loadstart', (event) => { setMediaMetadata(); }); navigator.mediaSession.setActionHandler('play', () => { Amplitude.play(); }); navigator.mediaSession.setActionHandler('pause', () => { Amplitude.pause(); }); navigator.mediaSession.setActionHandler('stop', () => { Amplitude.stop(); }); navigator.mediaSession.setActionHandler('seekto', (seconds) => { Amplitude.skipTo(seconds, Amplitude.getActiveIndex()); }); navigator.mediaSession.setActionHandler('previoustrack', () => { Amplitude.prev(); }); navigator.mediaSession.setActionHandler('nexttrack', () => { Amplitude.next(); }); }`
5.3.2
No response
The text was updated successfully, but these errors were encountered:
For properly implemented mediaSESSION see: https://codepen.io/ciberst/pen/wvjxjOR
Might have to be amended to work with amplitudejs
Sorry, something went wrong.
No branches or pull requests
Issue Description
https://developer.mozilla.org/en-US/docs/Web/API/Media_Session_API
New standard for all modern devices.
Expected Behavior
sync controlers with device.
ex: iOS control center
Steps To Reproduce
`// https://stackoverflow.com/questions/73993512/web-audio-player-ios-next-song-previous-song-buttons-are-not-in-control-cent
// https://developer.mozilla.org/en-US/docs/Web/API/MediaSession
if ('mediaSession' in navigator) {
var setMediaMetadata = function() {
currentSong = Amplitude.getActiveSongMetadata();
navigator.mediaSession.metadata = new MediaMetadata({
title: currentSong.name,
artist: currentSong.artist,
album: currentSong.album,
artwork: [{ src: currentSong.cover_art_url }]
});
};
AmplitudeJS Version
5.3.2
Browser Information
No response
Link To Where Your Issue Can Be Reproduced
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: