3 Replies Latest reply on Oct 13, 2011 6:44 AM by Dave Merchant

    VideoPlayerX or VideoPlayerPlus - auto close video window?

    dtm-1979 Level 1

      Just wondering if anyone has had any success trying to automatically close pop-up video windows (for embedded videos) at the end of the video with EventListener function?


      I have a presentation to make where the videos need to be pop-up windows.  Ideally, I want a play button, and a loop button, obviously window would close automatically only if the play button was pressed.


      There are a few posts floating round for reference.  And Dave Merchant mentions this exact feature with his VideoPlayerX in this post : http://forums.adobe.com/message/3569672#3569672, but I can't figure out what the JavaScript function would be.  All I know is my video is RM1!  and I'm currently trawling through the API reference in the event listener section!


      If anyone's had any success so far, could you let me know?  (Also, I'm a little unsure of where the event listener should go, doc level?  or put it with the button that initiates 'play'?

        • 1. Re: VideoPlayerX or VideoPlayerPlus - auto close video window?
          Dave Merchant MVP & Adobe Community Professional

          It depends on how you're doing it.


          If the close event originates from something being clicked in the SWF (such as a close button on the playbar) then you'll need to fire a timeout event from within ActionScript, and hence write your own widget - see Joel's blog for info.


          If you're reacting to the end of playback and you're using VideoPlayerX, then you can do it all in JS as the widget has an event manager (which isn't present in the default VideoPlayer widget) - though with the current build it's rather fiddly to handle the idea of closing a popup, as you can't assign a handler until the annotation is activated - a doc-level script won't work out the box as the ActionScript engine doesn't exist until the floating window is visible, so you have to juggle about with invisible buttons to take over control of the "click to activate" feature of the RMA.


          It's something which has been requested and I intend to make it easier in the next build of VideoPlayerX (due next week) by setting a default doc-level function to receive event messages. When it's released you'll be able to close the RMA by adding a doc-level function to the PDF, which says something like this (note this will NOT work with the current build or with the default player!):


          function vpx_listener(_name,_page,_event,_data) {

            if (_event=="stop") this.getAnnotRichMedia(_page,_name).activated = false;




          Note : The inbuilt Events objects and handlers in the JS API are not used by Rich Media Annotations - they're only used by legacy media (Screen and MediaPlayer objects) so you can ignore them completely. They were included because legacy media plays in an external application, so there was no other way for the PDF to tell what that application was doing, or if it broke. RMAs have no inbuild event handler system, hence the need to extend the ActionScript code in the widget.

          1 person found this helpful
          • 2. Re: VideoPlayerX or VideoPlayerPlus - auto close video window?
            dtm-1979 Level 1

            Thanks for the reply Dave, was hoping it was as easy as the next release of VideoPlayerX looks like it will be.  Ideally, I just want one button to invoke the video to play in a popup window, and for the window to close automatically when the video ends, it's as simple as that.


            Having little experience with Flash and AS, I didn't really want to go down the path of creating something new.  Also, I must say, when 99% of the time the widgets that you and Joel have created do the job.  Fantastic work on them, by the way.


            Maybe, if we both get lucky, you'll release it just in time for me to use in this presentation that I'm currently working on!   If not, I'll figure something  else out!


            Look foward to your next release of VPX.

            • 3. Re: VideoPlayerX or VideoPlayerPlus - auto close video window?
              Dave Merchant MVP & Adobe Community Professional

              New version is posted, including doc-level event listener and initialise functions. The auto-closing routine is now possible, see the feature notes for examples.