[TIMOB-4506] iOS: Titanium.Media.VideoPlayer 'complete' event always returns reason '0' or 'PLAYBACK_ENDED'
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Won't Do |
Resolution Date | 2020-01-09T19:13:15.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | TiAPI |
Labels | n/a |
Reporter | Anthony Decena |
Assignee | Ingo Muschenetz |
Created | 2011-06-27T12:49:24.000+0000 |
Updated | 2020-01-09T19:13:15.000+0000 |
Description
iOS 4.3 and Ti mobile SDK 1.7rc1
This involves the Titanium.Media.VideoPlayer object. In the 'complete' event, whether the video actually finishes or playback is exited by the user, the reason passed to the event always returns '0' or Titanium.Media.VIDEO_FINISH_REASON_PLAYBACK_ENDED.
Accompanying Q&A Issue: http://developer.appcelerator.com/question/121674/complete-event-firing-when-changing-url-on-video-player
I just ran into this bug. I need this event to know whether a preroll video clip was watched all the way through. Because I don't get a valid reason in the event object, I can't tell the difference between the user finishing the clip or exiting the player. Please increase priority on this issue.
@Jason Priebe: There was still no resolve on this issue. I suggest taking a look at the thread posted on the issue description. I came up with a simple workaround that you can most likely adapt to your own program.
Thanks, Ronnie -- I saw your workaround. I think it works great in a playlist scenario, where the user is actively switching from clip to clip. But in my case, I need to detect that the user has passively allowed the clip to play to completion, so I can treat it as a successful preroll playback. I don't think there's a clean way to do that. If I could intercept the user clicking on the "back" button to close the window, I could ignore the next complete event. But the only way I know to do that is to add an event listener to the window's close event. My gut tells me that the close event will happen *after* the video player's complete event fires. The workaround I've opted to use is to use a function called via setInterval to track the progress of the video playback. When it gets to the end, I record it as complete. But it's so hacky and inelegant. This is one of many glitches in the platform that trip developers up, wasting their time debugging Titanium instead of building apps!
I recently had to write a snippet that tracks the progress of the video and I too solved it via setInterval and knowing the duration of the clip. It's unfortunate but for now that is how we have to do it.
It has been decided that this issue should be closed as “Won’t do.” This issue is out of date with our current supported SDK release (7.5.2.GA as of the date of closure), and out of date with mobile OS versions. Updating, or creating code may not reproduce the issue reported, or be a valid test case. If community members feel that the issue is still valid, please create a new ticket. Please reference this closed ticket number, include SDK used, comments, and code that demonstrates/reproduces the issue.