Meta: This question is a follow-up, or a variant of a similar question about embedded Youtube videos: How to target "hidden" iframes? (application: links to starting positions of a "poster image hidden"-embedded Youtube video)
Definitions:
A "poster" image
A customized image on which you click, to reveal the actual A/V player.
Locally stored
The A/V is stored on your website, as opposed to a streaming service such as Youtube.
Clickable "positioning" hyperlinks
When a certain hyperlink inside an HTML text, a predefined starting (and perhaps ending) position of the A/V is addressed and automatically played.
I have been reading things on the net about function(){something.currentTime=...;});
, but I have not been able to implement this.
Demo
I'm sorry for the delay, and for it not being exactly the same as the Youtube one, the thing I lack most it's consistency, but here it is.
I've based this example in two songs from Hozier, one in audio and one in video format. (Hope nobody sues me)
As always you can modify the styles later on to fit your design, I just put something quick together to demonstrate.
Below, you will see a basic example of how the code works (for a more in-depth example, please refer to the demo).
HTML
Audio
Video
The only difference would be the class attribute, this being
mediaVideoFacade
instead ofmediaAudioFacade
.JavaScript
Feel free to ask any question's about the code, or report anything that is not working, good luck and hope it helps! :)
Updates
Added a
data-start
anddata-end
, note thatdata-end
will only stop the video if the time specified matches the current time of the video floored. Technically:if( Math.Floor(MediaCurrentTime) == DataEndTime ) stop();
This means if a jumper is called it will continue to play normally until it hits that number again, and if the jumper calls for a time beyond the data-end, then the video will be played normally.