I like to build a Video presentation website with dotvvm. when nothing happens it has to start every time a new video from a list. with the bootstrap/MediaObject i can't find the event 'video ready playing' so we can start the next video. what is the best way to solve this with Dotvvm, i don't want to go back to angular for this.
Bas
UPDATE: At this moment I use the html5 tags, is there also a dotvvm component ? sample:
<dot:Content ContentPlaceHolderID="ContentTemplate">
<div class="page">
<video ID="video1" width="320" height="240" autoplay>
<source src="/Style/video/video1.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
<button onclick="playPause()">Play/Pause</button>
</div>
<script>
var myVideo = document.getElementById("video1");
function playPause() {
if (myVideo.paused)
myVideo.play();
else
myVideo.pause();
}
myVideo.addEventListener("ended", function () {
//get next video from viewmodel, (not hard coded)
var nextVideo = "/Style/video/video2.mp4"
myVideo.setAttribute("src", nextVideo)
//load
myVideo.load();
// switch of sound
myVideo.muted = true;
// play
myVideo.play();
}, true);
</script>
can we get the nextVideo from the viewModel and how do we do this ?
1) Set javascript variable
you can set this way - eg. by button with command
MyView.dothtml
MyViewModel.cs
2. Get current value of Viewmodel property in View
or you can declare declare string property in viewmodel and in your javascript you can get current value by knockout call like this:
Viewmodel
View:
It depends on your script what you realy want to do :)