Icecast: pause in the beginning of streaming on Android - android

I have a server Icecast working with Liquidsoap to stream internet radio and I noticed there is a problem with receiving the music on some Android devices (Samsung Galaxy tab, for example) - after a few seconds of buffering of the music the playing of the music starts for about a second, then it abruptly stops, then there is a silence for a few more seconds, and only after that it starts playing normally. On some other Android devices, like HTC desire - no such thing occurs - music starts playing normally after the bufferization.
Here is the example of the stream in question: http://rdsradio.ru:8000/4th.mp3
That happens when I open the link in the browser (Google Chrome) on the Android device. With the same result I connected to the Icecast stream from the Android app, which I currently develop, using the android.media.MediaPlayer class: mediaPlayer.setDataSource("http://rdsradio.ru:8000/4th.mp3");
Also, even on those problem devices I could normally connect and listen the streams of other Icecast radio sources, like http://dancewave.hopto.org:9990/dance.mp3
- that is why I think there could be something wrong in my settings of Icecast + Liquidsoap - what makes that music stops playing in the beginning.
<burst-on-connect>1</burst-on-connect>
<burst-size>64000</burst-size>
I tried to change those parameters in /etc/icecast2/icecast.xml, like increasing the burst-size to 10-20 times or setting burst-on-connect to 0, but did not notice any difference at all (I run /etc/init.d/icecast2 reload after changing the parameters to reload the configuration).
Any idea - how to fix that behavior?
UPDATED: I tried to open the stream in VLC player on Android and it worked with no problem, so it seems the problem in using the android.media.MediaPlayer (probably the built-in HTML5 audio player in Google Chrome uses the same library). I will try to use a different Media Player in the app.

Actually, the solution was simple. The burst-size setting to 500000 in icecast.xml fixed the problem. Earlier I used /etc/init.d/icecast2 reload after changing the icecast.xml and for some reason I thought that the burst-size would also change in Icecast in the similar way, but it didn't happen. Only restart of icecast actually changed that setting.

Related

How can avoid audio streaming to stop after 5 minuter?

I made an PhoneGap app that contains an audio player with start / stop.
Player stream audio from shoutcast streaming.
It works perfectly on iOS and it also works on Android, even if the app goes is in background and the phone is lock
but after around 5 minutes audio stops
I tested on OnePlus 6t and has been tested on a Sony Xperia with same results
JS code
myaudio = new Audio(streamurl);
myaudio.id = 'playerMyAdio';
myaudio.play();
All apps without background tasks will get snoozed on Android after a while. You need to set up a background task so your app doesn't go into snooze.
Maybe you can try this plugin
https://github.com/katzer/cordova-plugin-background-mode

HD Video Playback issue with android things

Has anyone been able to successfully play a HD video using Android Things on a Raspberry Pi? If so was there anything special you had to do to get it to work? If not does any one know why it isn't working?
I made a simple video player that plays a local video from disk. The app runs fine on a phone but with android things maximum frames are getting dropped.
I am using ExoPlayer for the video playback and the same issue is observed when Media Player is used.Hardware acceleration is also enabled in the manifest file.

HTML5 video element does not restart a live stream at its live point if I pause it

As a viewer, I expect that if I pause a live stream, when I unpause it, it will restart from the latest live point.
Instead, on HTML5 video elements, the restart point is just where the stream left off - i.e. it's no longer live.
That's a problem for live streaming as what's more important to the viewer is to stay up to date with what's happening now rather than catch up on stuff he may have missed.
Please note that removing controls is not possible in iOS (so the issue will arise for a large number of mobile devices) and that HTML5 is a requirement (at least for my purposes) for any newer mobile devices on Android and iOS.
Has anyone cracked this problem?

No Video on HLS Stream Android 4.4.2 Samsung Galaxy S5

The HLS streams do not play video, but they do play audio.
Device information:
Samsung Galaxy S5
Android 4.4.2 / Build KOT49H
Chrome 36.0.1985.131
HLS Streams that play on other Android builds and devices:
JWPlayer test videos do not play video:
http://www.jwplayer.com/html5/hls/
These Apple HLS streams also do not play video (but do play audio)
http://devimages.apple.com/iphone/samples/bipbopgear1.html
http://devimages.apple.com/iphone/samples/bipbopgear2.html
http://devimages.apple.com/iphone/samples/bipbopgear3.html
http://devimages.apple.com/iphone/samples/bipbopgear4.html
http://devimages.apple.com/iphone/samples/bipbopall.html
Using the browser application "Internet" on the Samsung S5, it will play the video for an HLS stream, which made me think this could possibly be an issue with Chrome, however, when tested on a Nexus 5 device with the exact same Chrome build (except Android 4.4.4) and the video plays fine.
Android Issue Queue has Issue 63810: No video in HLS live streaming on Android KitKat and I have contributed what I can.
What can I do to get more information about the nature of the problem?
Is this a legitimate bug with the Android 4.4.2 Samsung S5?
I've noticed this behavior among other issues on 4.4.2 with issues seeming to vary by device and manufacturer. Through experimentation I've noticed the following:
Entering or exiting full screen seems to reset the renderer. I suspect this forces the browser to create a new View or something
Reloading the video seems to help the renderer
Changing sources seems to make things worse
Our product works essentially on a playlist -- when the ended event triggers for one video we change the video src and call .load() and .play() to go to the next one. On some devices if the first src is HLS video plays fine, but if the first src is mp4 or webm then switching to HLS causes you to lose video. On other devices it's the opposite behavior -- starting in HLS fails but switching to it succeeds. On some devices HLS has video if you enter full screen before it starts to play, on others it only has video if you enter full screen after it starts to play. On some devices the full screen button disappears after you start to play.
It's not ideal and it's honestly very hacky, but I've come up with this ugly solution:
// 1.
video.addEventListener('click', requestFullScreen);
// 2.
function requestFullScreen() {
video.removeEventListener('click', requestFullScreen);
video.webkitRequestFullScreen();
}
// 3.
function reloadVideo() {
var ext = video.src.substr( video.src.lastIndexOf('.') ).toLowerCase();
if( ext == '.m3u8' ) {
video.load();
video.play();
}
}
// 4.
video.addEventListener('webkitbeginfullscreen', reloadVideo, false);
video.addEventListener('webkitendfullscreen', reloadVideo, false);
// 5.
video.addEventListener('webkitfullscreenchange', reloadVideo, false);
This is to fix the "full screen button disappears after you start playing on some devices" bug
We give this function a name so we can remove it later. If they request to exit fullscreen then they will not blame your player if the full screen button disappears. At this point they'll blame the phone and they'll refresh the page. This way people don't get pissed off if they accidentally fullscreen it again while trying to scroll
A helper function. We don't want to restart videos when going fullscreen unless we have to
The stock Internet browser throws these two events
Chrome throws this event
There are a number of other hacks I've had to implement, as well. For instance, the stock Internet browser on the Galaxy S4 does not always throw an ended event when reaching the end of a video. For this reason I have a setInterval checking every 1 second. If the video has moved less than 0.5 seconds in the last 1 seconds and it was never paused (I have a flag that's set in the resume and pause events) then assume you've hit the end.
I've had success using preload="none". Switching to auto will only play audio, using none will play both video and audio properly. This was tested on a Samsung S3, Android 4.4.2.
EDIT: autoplay also contributes to the problem. Removing it appears necessary.

Android Media Player Streaming issue on Samsung Devices

I'm streaming the audio file (.mp3) from internet with Android Media Player.
It works quite well except Samsung Devices. As far as I see, it doesn't stream the audio but tries to download. It sometimes pushes Media Player Error (1 -1004). Nothing is getting played.
I also tried to redirect the Application to the Media Player with URL of audio file, it goes to Music Player application, indicating "Preparing..." for a while, but then It shows the message "sorry, player does not support this type of audio" with Toast.
Anybody else had the same error before ? Any advise to find a solution ?
Thanks.
There are some bugs in native sound libraries on Samsung Galaxy S2 for instance (look here). I had those problems (random crashes / freezes) and solved it by using OpenSL library for that specific case.

Categories

Resources