Note that there are some explanatory texts on larger screens.

plurals
  1. POTrying to implement jPlayer using jQuery Mobile - player stops when launching dialog
    primarykey
    data
    text
    <p>I am trying to design a page for mobile devices using jQuery Mobile that has jPlayer on the main page, and other content loaded either in tabs or another page or a dialog, such that the audio in jPlayer keeps playing.</p> <p>I am not sure how to implement tabs using jQuery Mobile, but I have tried adapting the 2 page example from the demos, and also a single page with a dialog which contains extra content, and using both methods the playback in jPlayer stops.</p> <p>I am not sure why this is happening. In the standard webpage I have designed using jPlayer and lightboxes, the lightboxes don't effect the playback in jPlayer, so I was hoping that it would be the same using jQuery Mobile.</p> <p>To test on an iPhone you will need to tap on a track to get audio playing.</p> <p>I'd be grateful for any help in getting this working,</p> <p>Thanks,</p> <p>Nick</p> <p>You can see the current page <a href="http://monthlymixup.com/iphone.php" rel="nofollow">here</a>. The code between the body tags is:</p> <pre><code>&lt;body&gt; &lt;div class="jp-audio"&gt; &lt;div class="jp-type-playlist"&gt; &lt;div id="jquery_jplayer_1" class="jp-jplayer"&gt;&lt;/div&gt; &lt;div id="jp_interface_1" class="jp-interface"&gt; &lt;div class="jp-video-play"&gt;&lt;/div&gt; &lt;ul class="jp-controls"&gt; &lt;li&gt;&lt;a href="#" class="jp-play" tabindex="1"&gt;play&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" class="jp-pause" tabindex="1"&gt;pause&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" class="jp-stop" tabindex="1"&gt;stop&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" class="jp-mute" tabindex="1"&gt;mute&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" class="jp-unmute" tabindex="1"&gt;unmute&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" class="jp-previous" tabindex="1"&gt;previous&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" class="jp-next" tabindex="1"&gt;next&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class="jp-progress"&gt; &lt;div class="jp-seek-bar"&gt; &lt;div class="jp-play-bar"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="jp-volume-bar"&gt; &lt;div class="jp-volume-bar-value"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="jp-current-time"&gt;&lt;/div&gt; &lt;div class="jp-duration"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div id="wrapper"&gt; &lt;div id="scroller"&gt; &lt;div id="jp_playlist_1" class="jp-playlist"&gt; &lt;ul&gt; &lt;!-- The method Playlist.displayPlaylist() uses this unordered list --&gt; &lt;li&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;script type="text/javascript"&gt; var myScroll = new iScroll('wrapper'); &lt;/script&gt; &lt;/div&gt; </code></pre> <p></p> <pre><code>&lt;!-- Start of first page --&gt; &lt;div data-role="page" id="playlist" data-position="fixed"&gt; &lt;div data-role="header"&gt; &lt;h1&gt;Playlist&lt;/h1&gt; &lt;/div&gt;&lt;!-- /header --&gt; &lt;div data-role="content"&gt; &lt;a href="#comments"&gt;comments&lt;/a&gt;&lt;/p&gt; &lt;a href="#comments" data-rel="dialog" data-transition="pop"&gt;open dialog&lt;/a&gt;&lt;/p&gt; &lt;/div&gt;&lt;!-- /content --&gt; &lt;div data-role="footer" data-position="fixed"&gt; &lt;h4&gt;Page Footer&lt;/h4&gt; &lt;/div&gt;&lt;!-- /header --&gt; &lt;/div&gt;&lt;!-- /page --&gt; &lt;!-- Start of second page --&gt; &lt;div data-role="page" id="comments"&gt; &lt;div data-role="content"&gt; &lt;p&gt;&lt;a href="#playlist"&gt;Back to playlist&lt;/a&gt;&lt;/p&gt; &lt;div id="disqus_thread"&gt; &lt;/div&gt; &lt;script type="text/javascript"&gt; /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ var disqus_shortname = 'monthlymixup'; // required: replace example with your forum shortname // The following are highly recommended additional parameters. Remove the slashes in front to use. var disqus_identifier = 'test'; var disqus_title = 'the marvelous monthly mix up'; // var disqus_url = 'http://example.com/permalink-to-page.html'; /* * * DON'T EDIT BELOW THIS LINE * * */ (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); &lt;/script&gt; &lt;noscript&gt;Please enable JavaScript to view the &lt;a href="http://disqus.com/?ref_noscript"&gt;comments powered by Disqus.&lt;/a&gt;&lt;/noscript&gt; &lt;/div&gt;&lt;!-- /content --&gt; &lt;/div&gt;&lt;!-- /page --&gt; &lt;/body&gt; </code></pre> <p>here is the script I currently have for showing and hiding pages:</p> <p><code>&lt;script type="text/javascript"&gt; $("div:jqmData(role='page')").live('pagebeforeshow',function(){ if($(this).hasClass('haveaplayer')) { $(.jp-audio).show(); }else{ $(.jp-audio).hide(); } }) &lt;/script&gt;</code></p> <p>and the html:</p> <p><code>&lt;div data-role="page" id="playlist" class="haveaplayer"&gt;</code></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload