0

Here is my scenario: I am embedding a video into a page that is packaged in phonegap. The first time you hit the page the video appears and will play. When the back button is hit the video stops playing and the you are returned to the previous page. If you try and navigate back to the video just the control bar shows up and the video doesn't appear. If you press play the audio plays but no video does. Here is my html code:

<section id="presentationlink_Demo" data-role="page" data-theme="b" data-fullscreen="true">
      <header data-role="header"><h1>Presentation Link - Demo</h1></header>
      <div class="content" id="presentationDemo" data-role="content">

          <OBJECT id="linkVideo" classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' codebase='http://www.apple.com/qtactivex/qtplugin.cab'>
              <param name='src' value="videos/PT/PT.mov">
              <param name='controller' value="true">
              <param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always">
              <EMBED src="videos/PL/PL.mov" controller="true" pluginspage='http://www.apple.com/quicktime/download/'>
              </EMBED>
          </OBJECT>
        </div>
      <footer data-role="footer" data-position="fixed"></footer>
   </section> 

The html is not touched by any js. Thanks in advance for any help.

Jeff W
  • 538
  • 1
  • 5
  • 15
  • Do you use ajax to transit between pages? Or are the pages refreshing on navigation between them? – bobek Jan 12 '12 at 14:37
  • I am using whatever is default in JQuery Mobile a4 to navigate between pages – Jeff W Jan 12 '12 at 14:50
  • I suspect that it is getting rid of the codec when you leave the page and not downloading it again when you go back, which might explain the audio only on the second go around. – Jeff W Jan 12 '12 at 14:59

1 Answers1

0

From your comments it seems like you are using default ajax transition between pages. Removing this behavior should fix your issue.

1) You can either add data-ajax="false" to particular links to remove ajax from them.

2) You could also refresh your div like here: Ajax - How refresh <DIV> after submit

3) You could remove ajax from all links using this:

     $(document).ready(function () {


         $('a').each(function () {
             $(this).attr("data-ajax", "false");
         });
    });

4) Or remove ajax using this:

$(document).bind("mobileinit", function () {

        $.mobile.ajaxEnabled = false;

});

Number 4 will also allow you to use POST calls in the future.

Community
  • 1
  • 1
bobek
  • 8,003
  • 8
  • 39
  • 75
  • When i use these solutions the buttons fail to navigate you to the next page. It seems that ajax must be enabled in J Query Mobile to move between pages. – Jeff W Jan 12 '12 at 15:59
  • No it doesn't. If you disable ajax, your page gets reloaded and your url changes. Do you have different files with each page or all pages in one file? – bobek Jan 12 '12 at 16:02
  • that's why. Try having those two pages in two different files, and the non-ajax links to them – bobek Jan 12 '12 at 16:08
  • So i added an external page for the video and used the data-ajax="false" attribute and navigates to the page but it messes up the jqm formatting. When the attribute is removed the page loads fine and looks like it used to – Jeff W Jan 12 '12 at 16:21
  • Add all the jquery and CSS references to your new page. – bobek Jan 12 '12 at 16:22
  • Once i add the css and js for jqm every thing looks alright, but there is no back button for me to get back to the previous page – Jeff W Jan 12 '12 at 17:10
  • Create it. `Go Back` In href put path to your previous page. – bobek Jan 12 '12 at 17:14
  • i am not able to get back to the last page because it is buried in the file with many pages in it, unless there is a way to link to a specific section – Jeff W Jan 12 '12 at 17:26
  • ask another question about it, it's related to the question you asked here. – bobek Jan 12 '12 at 17:33
  • found solution here: http://forum.jquery.com/topic/add-an-attribute-to-prevent-particular-pages-from-caching thanks for your help. – Jeff W Jan 12 '12 at 17:41