I'm building a online radio streaming app and so far it stream and play audio on android and ios. But when I started testing my app on ios device (iphone) I found an error.
"File Error - Unable to configure network read stream"
It happens when the network resets and when I resume iphone from the lock mode and try to resume audioPlayer from the pause mode. The audio player plays what left in the buffer and pop above error. Is there a way to check if the audio stream exists?
I also found if I change the pause button operation to "audioPlayer.stop()" and "start()" this error does not occur. Here's my pause\resume button code
pauseResumeButton.addEventListener('click', function() { if(Ti.Network.online) { if (Ti.App.player.paused) { // I need a condition here to check if audio stream exists before start player. pauseResumeButton.backgroundImage="/images/pause.png"; Ti.App.player.start(); } else { pauseResumeButton.backgroundImage="/images/play.png"; Ti.App.player.pause(); } } else { Ti.UI.createAlertDialog({ message: 'Network Offline', title: 'Error', ok:'Ok' }).show(); } });