I noticed that Windows Phone 7’s default browser doesn’t fire the “ended” event when a HTML5 video has ended.
So I thought I could constantly check the current time every 100ms and then calculate:
if (videolength - video.currentTime <= 0) alert("ended");
This also won’t work because Windows Phone 7’s native browser always does: "170 - 0"
video.currentTime is always 0, no matter at which part of the video I check.
How can I check if a video has ended on Windows Phone 7 then?
Update: I just checked the user agent of the browser and it says ie9. So, why does it not want to fire the “ended” event?
If you’re attempting to listen for the event using addEventListener, or via a jQuery binding, you need to use the event type “ended” rather than the name of the element’s event handler “onended”.
[Updated]
So it appears that IE 9 mobile supports a very limited subset of the HTML5 video API. This W3 demo is useful for testing which elements of the API it does actually support.
Depending on your requirements, which aren’t completely clear from the question, it seems to me that your options are very limited. You could either:
Oh, and Microsoft, if you’re going to follow Apple’s example and drop support for Flash on your mobile devices, at least make sure your browser supports a useful amount of the HTML5 video API.