Welcome to the Panopto Community

Please note: All new registrants to the Panopto Community Forum must be approved by a forum moderator or admin. As such, if you navigate to a feature that is members-only, you may receive an error page if your registration has not yet been approved. We apologize for any inconvenience and are approving new members as quickly as possible.
Options

Control Panopto player - Modal window

Hello all,

I'm currently working on a page inside our LMS where I'm embedding a several Panopto videos.

We decided to include each video in a modal window. So far so good. Now, when the modal is closed, and the video was not paused or stop, the playback continues and its audio continues.

Is there a way I can tell the player to stop once the modal is closed ?

Thank you so much for the help!

Answers

  • Options
    Michael EspeyMichael Espey Superstar
    edited December 2023

    If you have access to run some Javascript when that modal closes and you are hand coding the page, yes, in theory. Panopto has a Player Embed API and you should be able to add a callback to the bits you use to close the dialog which will update the player state (https://support.panopto.com/s/article/Learn-About-Panopto-Embed-API).

    I don't have any example code to share as I haven't done much playing around and we haven't really used the embed API for anything of substance, but the tools should be there to build what you are after.

  • Options

    Thank you, Michael for your answer.

    I have access to Javascript.

    I have used the API successfully to embed the video in my page. Now, I've been trying the following code without sucess:


    <script type="text/javascript">

     $('#exampleModal').modal('hide') { 

     function onPanoptoStateUpdate(state)

       {

          embedApi.PlayerState.Paused;

         }

     });

    </script>

    not sure if it needs to be at the same level of the embbeding code or outside. Not even sure if this is the correct syntax.

    Thank you once again for your help

  • Options

    I was able to make it work. Thank you for the help.

    Leaving the code here in case someone needs it in the future:

    The modal is called exampleModal. I have embedded the video using the code from the API. The code below pauses the video on modal exit:

     $('#exampleModal').on('hidden.bs.modal', function (e) {

     embedApi.pauseVideo();  

    });

Sign In or Register to comment.