Background music with .mp3 file plays late - cocos2d-x

I use cocos2d-x RC1 and I need a background music to play from an mp3 file. The problem is that it starts to play after 2-3 seconds. I have tried to preload it but here is the problem:
void SimpleAudioEngine::preloadBackgroundMusic(const char* pszFilePath)
{
}
SimpleAudioEngine::preloadBackgroundMusic is a dummy function and does nothing. Also there is no callback that tells that background music is loaded, so that I could show loading screen untill that moment. Now I don't know how to control the time the music will start to play.
Another was is the .wav file that plays immediately, but .wav file size is 49Mb, which is nonsense. Thus, I stuck. Please help.

I answered your question on the Cocos2d forums about filing a bug for this.
Also, please try and reproduce this in the latest final release: http://cocos2d-x.org/download

Related

How to mask an embedded audio file from being seen and downloaded from dev tools?

For a small website I am creating, I have an embedded piece of audio which plays on the landing screen, the current method I am using is just by simply embedding it via standard html:
<audio autoplay loop id="player" src="audio1.wav"></audio>
The issue with this method is it is possible to find and download the src when looking in devtools. I want to mask the src so nobody can find it and download it, as the audio is up for sale/copyrighted.
Is there a method where the original .wav audio file cannot be traced back and downloaded?
There's no real way to prevent someone from obtaining the audio in one way or another if they're determined enough. However, a few alternatives are listed here, with some more concrete code examples here. Consider only playing a small sampler to prevent someone from getting the entire audio clip.

JWPlayer mp3 playlist does not auto load next track

I am using JWPlayer for a long time but have a problem with playlist not auto loading next tracks in iPhones. I have JWPlayer version 6 loaded with an rss playlist of MP3 files. If the user has the browser open the next track loads and starts playing. If the phone is locked it does not start playing the next track automatically for some reason.
Website: gurbanivichar.com
I would appreciate if someone can help.
Update
I have asked JWPlayer support for help but it seems like they are not able to replicate the issue for some reason. I on the other hand have this issue on iPhone 4s/5/6s/7 and iPad, other iPhones I have not tried.
JWPlayer support thread: https://support.jwplayer.com/customer/en/portal/questions/16729726-mp3-playlist-auto-play-next-tracks-in-iphone?new=16729726
If you can help be reproducing the issue, would be appreciated.
I investigated this issue thoroughly and found that this because of iPhone/iPad limitation that apple has put in. The limitation stops audio/video to autoplay without any interaction. The initial trigger has to come from the user.
So due to this, I have decided to allow users to download an m3u playlist to play on an audio player on the device such as Remote Media Manager, it allows an M3U from any URL to stream music from the web.
Thanks for your help.

HTML5 Video element does not a resume live streaming when a stream is interrupted then restarts

I'm using JW Player to live stream content onto a web page. The player is backed by an open-source library called cine.io.
My issue is that the player falls back to an HTML 5 video element for all mobile web, both on iPhone and Android. There are some differences between the flash solution of JW Player and HTML5 - notably that if a live stream starts, then stops, then restarts, the video element will not pick up the restarted stream.
This is a problem since streams often drop in and out - and the flash solution does pick up the restarted stream.
I tested a bunch of listener methods on the video and the only one that signalled that the stream had ended was a "time update" listener:
$video.on('timeupdate', function(){
//Do something
});
However none of my attempts to re-open the stream have been effective.
Is this even possible? Can anyone provide pointers?
Would an example like this work?
http://support.jwplayer.com/customer/portal/articles/1442607-example-a-custom-error-message

HTML 5 Audio Tag long buffer time

I am currently using the HTML 5 audio tag in one of my projects. I load an MP3 file from an external source and then initiate it like that:
$("#audioPlayer").attr("src",audioStreamURL);
document.getElementById("audioPlayer").play()
This works fine, but I noticed that the Audio-Tag takes a long time to buffer before playing the file (Chrome and Safari), which causes a delay of a couple of seconds and thus reduces the user experience significantly.
Checking the console in Chrome, I noticed that the audio most times starts once ca. 5 MB have been "transferred".
I also checked if it is due to the server's latency and loaded the audio file in VLC-Player. However, here it started right away, with no delay at all.
Does anybody know, why Chrome does that? And even more important: Does anybody know a solution for that problem? A workaround or audio-tag alternative?
I would really appreciate your help!
Have a look at the "canplaythrough"-event of HTML5 Audio. This event fires when the Audio is able to play without buffering. You could bind a listener to that event, that will play the Audio.
Maybe this will be faster than just playing the Audio, which will wait for the complete file to be downloaded.
There I demonstrated how to preload an HTML5 Audio: preloading the next song in a playlist a bit before the current one ends

Preloader stalling flash movie in IE

This is only a problem in IE.
the following actionscript is for a simple preloader for a movie i'm working on. It works fine in Firefox but the movie stops on the first frame of the preloader when opened with Internet Explorer. Has anyone had this problem before?
stop();
addEventListener(Event.ENTER_FRAME,checkLoad);
function checkLoad(e:Event):void {
var pcent:Number=this.loaderInfo.bytesLoaded /this.loaderInfo.bytesTotal*100;
bar_mc.scaleX=pcent/100;
loader_txt.text=int(pcent)+"%";
if (pcent==100) {
removeEventListener(Event.ENTER_FRAME,checkLoad);
this.gotoAndPlay(2);
}
}
Watch out for division-by-zero errors!
var pcent:Number=this.loaderInfo.bytesLoaded /this.loaderInfo.bytesTotal*100;
You cannot assume that loaderInfo knows the total number of bytes. Sometimes the sever wont tell the browser how big the file is going to be. In your case the file was probably already cached by Firefox but not IE.
Some people solve this by letting the swf know the file size beforehand, others configure their webserver to send this information.