1

When user leaves page where plays video playback is not stop. How can I solve it?

Thanks!

    <div class="panel left" data-role="panel" data-position="left" data-display="push" id="panel-01" >

        <ul>
            <li><a href="#initPage" title="Home">Inicio</a></li>
            <li class="profile"><a href="#profilePage" title="Profile">Perfil</a></li>
            <li class="newsfeed"><a href="#dialerPage" title="Setting">Llamar</a></li>
            <li class="report"><a href="#" title="Logout">Ayuda</a></li>
            <li class="logout"><a href="#" title="Report">Salir</a></li>
            <li><a href="#formPage1" title="Report">Creditos</a></li>
            <li><a href="#" title="Report">Idioma</a></li>
        </ul>
    </div>
    <div class="header" data-role="header">
        <span class="open left"><a href="#panel-01">&#61641;</a></span>
        <span class="title">VIDEO</span>
    </div>
    <div class="content" data-role="content">


<embed id="bgvid" src=""></embed>

    </div>

1 Answers1

0

jQuery mobile loads pages via ajax into the main page. So when you leave the video page it remains in the DOM. You can use one of the pagecontainer events like beforechange( event, ui ) to detect when the user is leaving the video page (use the prevPage property of the UI object to see which page the user is leaving).

In the handler, stop the video playback.

ezanker
  • 24,628
  • 1
  • 20
  • 35
  • can you give me an example please? – Frontend_87 Feb 07 '15 at 10:05
  • @PedroVB, which part don't you understand? If you want more help you need to post your code so we can see what you are actually doing. – ezanker Feb 07 '15 at 17:43
  • this is the code of the video page, the src of the video is secret sorry – Frontend_87 Feb 09 '15 at 10:32
  • @PedroVB, you could remove the embed tab from the DOM on beforechange and add/re-add it on page show: http://stackoverflow.com/questions/2493706/javascript-changing-src-attribute-of-a-embed-tag – ezanker Feb 09 '15 at 14:57