Fallback to current url as metadata title

This commit is contained in:
Fernando Jiménez Moreno 2019-11-15 10:02:38 +01:00
parent 6ee21af0c4
commit d33c96b31e

View file

@ -1728,10 +1728,15 @@ impl HTMLMediaElement {
self.render_controls();
}
let global = self.global();
let window = global.as_window();
// Send a media session event with the obtained metadata.
self.send_media_session_event(MediaSessionEvent::SetMetadata(MediaMetadata {
// TODO(ferjm) set url if no title.
title: metadata.title.clone().unwrap_or("".to_string()),
title: metadata
.title
.clone()
.unwrap_or(window.get_url().into_string()),
artist: None,
album: None,
}));