0

videoPlayer pause/resume works.... sometimes...



NOTE: This post refers to a seemingly unstable and inofficial functionality - I don´t recommend using it, but just want to learn more about how the video playback works. Our recent project required a play/pause functionality during video playback. We read that it´s not officially supported, and there is nothing in the ObjectReference either... but I tried it anyway. I just used these calls, placed in subroutines: videoPlayer.pause() videoPlayer.resume() ..and it worked! ...At least until I tried to play/resume videos at arbitrary moments: I experienced some crashes when the video was almost over and I tried to pause/resume it there. My custom script for a playlist of movies waits for the videoEvent 8 (video ended), then simply loads/plays the next movie. So I tried disabling pause/resuming between the events 8 and 3 (video ended/loaded) when there is no video in memory, but that didn´t help much. Btw: The "video ended"-event appears to not occur at the exact end of the movie, which caused several problems in my script (or at least I could not rely on it, but why?). Another cause for crashing seems to be the use of EnableZoneSupport(true/false) during runtime, i.e. for toggling a debug text field with the GPIO-side button, especially in combination with paused videos. Since this was not a necessary feature, I just disabled it - I guess this is not what EnableZoneSupport() was made for. I finally hard-coded all movie lenghts and added timecode events at (1 second) and (movieLength - 5 seconds). Pausing is now only allowed 1 second after the movie has started, and 5 seconds before it ends. That solved the crashes, and the script is running fine. I learned a lot on the use of BrightScript during this project, but some questions are:

    2 comments

    • 0
      Avatar
      RokuLyndon


      Can you tell me what firmware you are using? You can find it by starting up with no flash card inserted. Depending on the firmware release, the pause resume bugs you described might have been fixed. I hadn't heard of them previously. If they still exist, I'll log a bug for them to be fixed.

      - Why does pause/resume work, and why does it crash... or: Why does my workaround (avoid pausing close to beginnings/ends of movies) work at all?
      Answer: It could be a bug that's causing the crash. Knowing more about your firmware will help. If it is a bug, it could be related to what you describe where there's an issue near the beginning or end of a video. We'll test to duplicate in our qa lab.

      - Will the roVideoPlayer object support pausing/resuming in a future version?
      Answer: The plan is to have this feature working.

      - Why does the videoEvent 8 occur earlier than the actual end of the video?
      Answer:  I would need sample files to test this but this hasn't been my experience nor have I had any one else report this. It's possible if there are problems with the timestamps in the video, that could cause the premature ending. Are we talking about frames early or seconds early? Is it consistent in how soon it stops or does it vary? If you download some of our sample content form the quickstartkit, do those videos have the same problem?

      - What is the recommended way of implementing a playlist?
      Answer: I don't understand this question. We have playlist support both in the old autoplay.bsp format, and BrightAuthor software. If you're asking how you should implement a playlist in a script, then that's up to you. Normally, you have a list of files either in a roList object or in an array, and you play one, and when it's finished, you play the next one until you get to the end of your list, then you restart. I don't know if this answers you question.

      - Can EnableZoneSupport() be used to toggle a text window at the press of a button?
      Answer: No you can't. In the object reference, there should be a show and hide function listed for the roTextwidget object. You can use that to hide or show the text widget.
    • 0
      Avatar
      Martin Spengler


      First of all, thank you for the quick and detailed answer!

      Can you tell me what firmware you are using? You can find it by starting up with no flash card inserted. Depending on the firmware release, the pause resume bugs you described might have been fixed. I hadn't heard of them previously. If they still exist, I'll log a bug for them to be fixed.


      I am using version 3.2.67. Just wondering: What is the development status of roVideoPlayer.pause()/resume()? Is it "semi-supported" - since you are actively fixing bugs - in preparation for an official release? Is there a more up-to-date documentation dealing with these methods? (I am using "HDCompact_ObjectReferenceManualv3.1.pdf")

      - What is the recommended way of implementing a playlist?
      ... If you're asking how you should implement a playlist in a script, then that's up to you. Normally, you have a list of files either in a roList object or in an array, and you play one, and when it's finished, you play the next one until you get to the end of your list, then you restart. I don't know if this answers you question.


      Yes, that answers my question. I need full (scriptable) control of the movies, and currently use the video events (as mentioned) to trigger the next playlist entry (array of filenames).

      - Why does the videoEvent 8 occur earlier than the actual end of the video?
      Answer: I would need sample files to test this but this hasn't been my experience nor have I had any one else report this. It's possible if there are problems with the timestamps in the video, that could cause the premature ending. Are we talking about frames early or seconds early? Is it consistent in how soon it stops or does it vary? If you download some of our sample content form the quickstartkit, do those videos have the same problem?


      The difference between the last frame and the event was maybe 0.5 - 2 seconds (guessing), so there was a slight but noticeable chance of producing unexpected behaviour with our serial input device (= 20 buttons, one per movie)...

      Unfortunately, I don´t have the device at hand (nor the time) for further testing. Afaik, all videos were self-encoded, and maybe re-en/decoded several times between different production steps, so that could be the source of the problems. Since both the pause/resume and the videoEvent-bug could be related to incorrect timestamps, this is a likely explanation. I will report back as soon as I did some more tests with sample/selfmade files.
      Thanks again!
    Please sign in to leave a comment.