I want to start a AMP(Azure Media Player) HTML5 video on specific time to show specific content of the video.
What does not work is the time to start. The videos always start at 0:00 and then plays nicely to the end. No useful notifications in js console.
I read through some examples and the documentation and this is what I have tried, (note the line myPlayer.currentTime(30);):
Script:
var myPlayer = amp('vid1', { /* Options */
"nativeControlsForTouch": false,
autoplay: false,
controls: true,
width: "640",
height: "400",
poster: ""
},
function () {
myPlayer.src([{
src: "http://amssamples.streaming.mediaservices.windows.net/91492735-c523-432b-ba01-faba6c2206a2/AzureMediaServicesPromo.ism/manifest",
type: "application/vnd.ms-sstr+xml"
}]);
myPlayer.currentTime(30);
console.log('Good to go!');
this.play(); // if you don't trust autoplay for some reason
// add an event listener
this.addEventListener('ended', function () {
console.log('Finished!');
});
});
HTML
<video id="vid1" class="azuremediaplayer amp-default-skin">
<source src="" type="application/vnd.ms-sstr+xml" />
<p class="amp-no-js">
To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video
</p>
</video>
I have used the following source to set this up. Link to documentation I have used