-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
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
Add WIP Media Session sample #468
Add WIP Media Session sample #468
Conversation
let index = 0; | ||
|
||
function onPlayButtonClick(event) { | ||
playAudio(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: could maybe remove event
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
|
||
/* Seek Backward & Seek Forward */ | ||
|
||
let skipTime= 10; /* Time to skip in seconds */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: space before =
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for noticing!
|
||
function getPlaylist() { | ||
return [{ | ||
src: 'jam.ogg', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not crucial, but it would be really nice to have a different audio file for each track :).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samdutton That is my main issue there. Instead of having to upload one single audio file, I'd like to use some CC audio files from our server. Do you know if we already have some?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah... I see.
I have one short recording I did of me playing guitar: https://simpl.info/audio/audio/audio.mp3. Of course, you'll still need to add a licence. (I probably should add something to simpl.info, even though it's my recording.) I guess I could do four more if need be (if you can face more of my guitar playing :).
Alternatively, I just found these Sintel recordings (used by Dale Curtis for his MSE gapless playback article: https://developers.google.com/web/updates/2015/06/Media-Source-Extensions-for-Audio):
https://github.com/samdutton/simpl/tree/gh-pages/mse/audio/audio
}]; | ||
} | ||
|
||
function getArtwork(text) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be inclined just to have these as local images — the getArwork()
code adds a bit of complication.
Having said that, it's nice to show that you can get a remote image file.
Hmm...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah... I know ;)
That's why I've kept it this getArtwork
function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
||
function getArtwork(text) { | ||
return [{ | ||
src: 'https://dummyimage.com/96x96?text='+text, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: spaces around +
throughout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
let skipTime= 10; /* Time to skip in seconds */ | ||
|
||
navigator.mediaSession.setActionHandler('seekbackward', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I be able to see the seeking controls? I only get previous/next on Android.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your feedback @samdutton! |
I've decided to use Jan Morgenstern's awesome work. What do you think of it? |
Beautiful! Great choice. |
+1 Awesome indeed! |
* Add WIP Media Session sample * Address @samdutton feedback * Use Jan Morgenstern work
R: @jeffposnick @samdutton
Instead of having to upload one single audio file, I'd like to use some CC audio files from our server. Do you know if we already have some ready?
This sample will be featured in with google/WebFundamentals#4057
FYI: @mounirlamouri @xxyzzzq
Demo: https://beaufortfrancois.github.io/samples/media-session/