-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Load existing media element #707
Load existing media element #707
Conversation
…aelement.js to load existing media element
…nto load-existing-media-elt
var media = elt; | ||
media.controls = this.params.mediaControls; | ||
media.autoplay = this.params.autoplay || false; | ||
media.style.width = '100%'; |
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.
Maybe we shouldn't change the way an existing element looks? It can be done in the app's CSS.
Yeah, sure. An example with an existing video element would be nice, since it's asked about a lot. Thank you very much! |
Thanks for your quick feedback, @katspaugh! All good points, and I'm sorry I should have updated some of these before sending the PR. I will update this all soon, and I'll add a demo with video. |
Updated and added an example using a While consolidating the code, I was thinking... why not could just use |
Thanks!
Yep, sounds like a good idea! |
@@ -89,7 +124,7 @@ WaveSurfer.util.extend(WaveSurfer.MediaElement, { | |||
}, | |||
|
|||
seekTo: function (start) { | |||
if (start != null) { | |||
if (start) { |
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.
Why did you change this? If start is 0
we want to go to the beginning, not to the current position.
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.
Good call, I will revert this. While I was testing, setting media element .currentTime was always going back to zero, and I made this while troubleshooting before I realized it was due to the server (python simple server) and had nothing to do with the library. I should have reverted this and remembered that from your stack overflow post. Works fine on other servers.
Thanks a lot, @therewasaguy! |
Adds the ability to load an existing HTML5 or
Usage:
init wavesurfer with
backend: 'MediaElement'
.What is the best way to document this? Should I add a line to
docs/methods.html
in the gh-pages branch and an example?If anyone has suggestions let me know and I'll happily update the PR.
( re #698 )