On our platform, the test case "18. MediaElementEvents" in "http://qual-e.appspot.com/ " fail due to "ended" can not be triggered in Cobalt
The following js code in conformanceTest-20170531180007.js:
media.addEventListener('ended', function() {
self.log('onended called');
runner.succeed();
});
I can not receive ended callback and test case will fail
The following C code in html_media_element.cc:
if (!SbDoubleIsNan(dur) && (0.0f != dur) && now >= dur && playback_rate_0)
{
......
if(!sent_end_event)
{
send_end_event_ = true;
ScheduleOwnEvent(base:Tokens::ended());
}
......
}
You can see that there is checking for "now >= dur" which may cause ended callback not be triggered anymore. Because platform may exist a tiny gap between the current time at EOS and duration. Take this test case as an example, "dur" is 1.000s, but "now" maybe stay 0.98ms on the platform at EOS.
(1) Now, Stardboard API can not receive duration from Cobalt. Duration is always -1. If Stardboard can pass duration to us, we can force current time at EOS equal to duration when notify "kSbPlayerStateEndOfStream" to Cobalt.
(2) Maybe remove the check "now >= dur" simply also fix this issue.
Could Cobalt fix this issue by the way (1) or (2)? Or do you have any other suggestion?
Thanks