Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4506] iOS: Titanium.Media.VideoPlayer 'complete' event always returns reason '0' or 'PLAYBACK_ENDED'

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionWon't Do
Resolution Date2020-01-09T19:13:15.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTiAPI
Labelsn/a
ReporterAnthony Decena
AssigneeIngo Muschenetz
Created2011-06-27T12:49:24.000+0000
Updated2020-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

Comments

  1. Jason Priebe 2014-09-22

    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.
  2. Ronnie Swietek 2014-09-22

    @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.
  3. Jason Priebe 2014-09-22

    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!
  4. Ronnie Swietek 2014-09-22

    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.
  5. Alan Hutton 2020-01-09

    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.

JSON Source