Preloading specific amount of audio

46 views
Skip to first unread message

Sagar Shinde

unread,
Apr 7, 2014, 1:56:20 AM4/7/14
to jpl...@googlegroups.com
I am developing a site with live streaming as well as podcasts and other audios. Its such that when I go to a specific page and play the audio and then goes to the other page the previous audio should continue playing. When I press play on the current page the previous page audio should stop and then the current page audio should start.

I have been able to achieve this by passing the Audio url to the jplayer when a Custom made play button is clicked (The play button I am speaking here isnt the jplayer play button but a normal button whose click actions invokes jpalyer(setMedia) and jplayer("play")

How the scenario is such that, because of my requirements I initialize or reinitialize the jplayer on the page load of each audio page as I want that to run in background. 
I cannot preload it as well as the user may not play a audio even after being on that page when a older audio is playing. 

But because of the logic I have used there is a very long delay in the audio being played and the jplayer("play") function being called. Its understandable for live streams. 
Now my issue is that I want to have a preload of the audio of the current page with the audio of the previous page playing the background. So with that when the play button is clicked there isnt much delay from actually hearing the audio. (currently the delay sometimes goes to 10-30 secs).

It works fine on the Desktop devices but is a big delay problem on Mobiles and Tablets. 

I have been searching for long on this on stackoverflow too but didnt get a right solution to it.

I know this is a bit confusing. I can try to explain better if needed.

Sagar Shinde

unread,
Apr 15, 2014, 6:57:39 AM4/15/14
to jpl...@googlegroups.com
No replies to this post Yet. 
Waiting for some help

Mark Panaghiston

unread,
Apr 16, 2014, 3:52:04 PM4/16/14
to jpl...@googlegroups.com
Some of what you ask confused me... Epecially this bit:

Now my issue is that I want to have a preload of the audio of the current page with the audio of the previous page playing the background. So with that when the play button is clicked there isnt much delay from actually hearing the audio. (currently the delay sometimes goes to 10-30 secs).

I will try and answer the points in that paragraph...
  • preload of the audio of the current page: Usually the preload:"metadata" default option is fine to do this. It can sometimes be a problem on Chrome if you have more than 6 different pieces of media trying to play together.
  • with the audio of the previous page playing the background: On a new page the "system" is oblivious to what was on the previous page. If you know what we being played, either through a cookie or url param, then you can use jPlayer to start it playing on the new page... But the auto-play will not work on mobile.
  • currently the delay sometimes goes to 10-30 secs: This is unusual again. This type of thing only happens with some live-streams and when you are trying to play loats on the same page. Agaian, Chrome can have issues with that sort of thing.

I'm still not sure I understand you.

Maybe a link would help.

Sagar Shinde

unread,
Apr 20, 2014, 11:32:42 PM4/20/14
to jpl...@googlegroups.com
Thanks for the reply mark.

Let me clear some things which may have confused you.

Some of what you ask confused me... Epecially this bit:
Now my issue is that I want to have a preload of the audio of the current page with the audio of the previous page playing the background. So with that when the play button is clicked there isnt much delay from actually hearing the audio. (currently the delay sometimes goes to 10-30 secs).

Presently my Site is a single URL site, and I hide unhide divs and tags to produce different layouts to the user. What I have is a single HTML page with many hidden divs.
Here I say page as in layout change to user.
So Here I dont need any cookie based functionality and as I aint changing or refreshing the page so the jPlayer instance remains the same too.
Now When I play an audio and then go back to the menu page ( Again page means the menu div by hiding other section). And from menu I go to a audio page (audio page means div which displays the jplayer and the description of the audio being played). As I use a single instance I put a dummy play button on the current div (as one jplayer instance is already playing in background) and when that dummy play button is clicked I change the audio url and then call jplayer Play function.

As I call setMedia on run time there isnt any preload happening for the 2nd audio which is being played.
I wanted to know something which can work as follows.
- Jplayer playing a song.
- I add a new song to the playlist when I visit a div having a specific audio.
- Pre-load the newly added audio (the background audio shouldnt stop).
- And when the user clicks I play the next song from the playlist which out any delay or buffering.


Its ok if the live streams are delayed while playing but not with the stored Mp3s on the site. 

Jonathan H

unread,
Apr 21, 2014, 1:12:58 AM4/21/14
to jpl...@googlegroups.com
I'm not from jPlayer itself, but something that would massively help is a link to the page. 


--
You received this message because you are subscribed to the Google Groups "jPlayer: HTML5 Audio & Video for jQuery" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jplayer+u...@googlegroups.com.
To post to this group, send email to jpl...@googlegroups.com.
Visit this group at http://groups.google.com/group/jplayer.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages