Android several MediaPlayers - android

I want to show 4 views which will be streaming video from server. I created 4 views which are streaming video and I tested it on Nexus 7(2013), it's work fine. But when I tested on another device (Samsung Tab2) videos freezes after several minutes and some videos don't even start. It happens because MediaPlayer receives Error (100,0). I tried restart MediaPlayer when MediaPlayer.OnErrorListener receives this error, but after restarting I receive same error. This problem I have even with 2 MediaPlayers, but if I have only one MediaPlayer it's work perfect. As I understood my samsung can't work normally with more than one MediaPlayer. How can I figure out how much mediaplayers will work fine with some device? Or maybe someone faces off the same problem and can help me

It is look like Android issue http://code.google.com/p/android/issues/detail?id=17802 You could try to use other player like ExoPlayer

Related

Android Video on Chromebook dropping First Few Frames

I have an app which plays a lot of video files. It's been all good on every phone and tablet I've tested on. I just tested on an Acer Chromebook and the first few frames (maybe up to a 1/4 second) are being dropped on all video files, so the video appears to start just slightly beyond 0. Some of the videos have audio that starts immediately and so it's obvious to the user that the video is clipped at the start. I'm wondering if anyone else has seen this issue, maybe on a Chromebook or other device and if there is some simple way to deal with it?
There is absolutely nothing fancy about my code. I'm using VideoView, preload the video with setVideoURI(), then call videoView.start() on a button press.
Thanks!
This problem only appears if I make a call to seek(0). So rather than doing that to replay the video I have to load the video each time it's requested. That workaround resolves the problem.

Icecast: pause in the beginning of streaming on 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.

In Unity 5.0, the audio for android have lag, any way to reduce the lag?

In my game, I need to have shoot, hit, blast sound effect, and they are all less than 1 seconds. However, when the sound plays, it have lag on some specific devices.
HTC One M8: 0.4s lag
Samsung Galaxy S6: 0.4s lag
Samsung Galaxy S3: 0.4s lag
Samsung Galaxy Tab 3: no lag
iPad Air: no lag
Any idea how to solve the problem?
I already tried the following:
AudioSettings, best latency;
All audio data are wav;
All audio data are imported and compressed as PCM;
All audio data are "decompress on load";
AudioSources bypass all the effects;
There is a Android latency plugin, seems not working on new Unity, there is no sound at all;
There is another audio plugin, which have the same problem.
I have an s3 and experience no lag with audio. Even with lots audio files playing and overlapping.
This is leading me to believe something else is causing lag which results in your audio doing this.
Theres nothing posted here with how you went about setting this up or what other logic is happening when the audio file gets Play()'d
Ive had similar effects on my s3 when using coroutines, but i eventually found it was my wrong doing, specifically with the coroutine.
Hope this is helpful in anyway for you and good luck!

Youtube API Video stops when not on full screen

I'm using the youtube API and I did the instructions from this tutorial:
http://javatechig.com/android/youtubeplayerview-example-in-android-using-youtube-api
All is well, but when I'm not on full screen, the video keeps stopping every second. It's like it plays for 1 second, stops, then I have to press the play button again, then it will stop again after 1 second. On full screen, it plays perfectly. I'm 100% sure it's not the internet connection because I tried it with many connections and it ONLY plays properly on full screen. Any idea how I can fix this?
EDIT: It's not the phone either, I tried it on a Nexus 5, Sony Xperia z1, HTC One, a number of Samsung Galaxies. I rechecked the code multiple times, it's exactly the same, even did a copy paste of the tutorial. It still stops when it's not on full screen. I only used the tutorial, since I wanted to make sure it works before embedding it to my main project.
I solved my problem by removing the padding in the youtube video player. It now plays perfectly regardless of orientation.

Some videos causing android media player to crash

While testing an app that I was making to play videos in a loop from a playlist using the MediaPlayer, I found that one video caused my app to freeze. It didn't force close or anything just froze. After I took the video out it ran fine. But the video didn't cause it to crash every time. I was stability testing the app and it would run for at least 5 hours so it played the video a number of times before freezing. After I took out the video and put in different ones it worked fine (some were bigger and I added more than one). All the videos I was testing were mp4's and there was nothing noticeably different about the one that was crashing.
Any ideas why the video was causing the crash? It's not a huge issue but it would be nice to know so I could maybe check for it before adding a video to a playlist.

Categories

Resources