I'm trying to use live streaming in my application. To do that, I've used MediaPlayer to play the video, SurfaceView to display the video and HLS protocol. It is working well, but on some devices, I've received some problems which the most important one is:
E/MediaPlayer: Error (1,-2147483648)
I've searched a lot about this problem (here in StackOverflow site and the others) but found no appropriate solution. according to this site the HLS protocol is supported by android since API 16 as well, but that problem is reported on devices with API greater than 16. My major question is:
why this problem occurs? (Consider I'm using live streaming in HLS protocol, not local file)
Related
I have a problem with playing video on some devices. I am using textureview with mediaplayer, every methods of SurfaceTextureView are called but when I just call mediaPlayer.start(), immediately the listener with completition of playing is called. In log is this error:
E/MediaPlayer﹕ error (1, -2147483648)
When I list log from all applications, I can see some errors and I dont know if it is somehow related http://pastebin.com/rRxxQgdJ
This log is from CyanogenMod with Android 4.3.1 but on some other devices like Samsung Galaxy S3 mini this error is happening.
On my Nexus 4 everything works fine. I've tried convert that video with mp4 codec for android H.264 and even with ffmpeg but the result is still the same. I am using TextureVideoView implementation from here:
https://github.com/dmytrodanylyk/video-crop/blob/master/library/src/com/dd/crop/TextureVideoView.java
Thanks for any advice
As I already pointed it out here it may be due to the fact that video encoding parameters (profile, level, pixel format, etc.) are not supported on the platform, try playing around with the source.
I am trying to achieve HLS streaming in Android.
I have setup the HLS streaming server (apache2) in Ubuntu desktop and able to play the stream using the VLC player on Desktop.
But when i try to play the stream using VLC player in Android, I am not play the video, nor I am getting any error.
If anyone has tried similar streaming, please provide your inputs.
Thanks
Following some further investigation, I've found the following information that can hopefully help other people get HLS streaming on Android working.
Encoding - The video encoding, and the segmentation setup can have a large impact on the Android versions that the video supports. I ended up creating a video using HandBrake, with the following settings:
MP4 File
H.264; Baseline Profile; Level 3
AAC Audio; 44.1k; 128bit (Note: I found that JellyBean was a lot more picky about the audio than ICS/Honeycomb. Some audio bitrates would create videos that Jellybean would not play at all. In general Mono and low bitrate audio seemed to work better on Jellybean).
Segmentation - Using the Apple MediaFileSegmenter, I found adding the "-no-floating-point-duration" and "-z none" flags allowed me to create a video that worked across Android 3.0->4.2
Gingerbread - I was unable to get Android 2.3 to work with HLS out of the box, but I did find that using the Vitamio library worked pretty well (see this question for further info)
I can play the .m3u8 with the native MediaPlayer in android. But, I don't want to be rejected by Gingerbread users. I find a player named Vitamio said to be a wonderful player that can play HLS streaming on 2.x. However, when I import it into my project, the app is not responding, leaving me the log saying avformat_open_input: I/O error -5. The .m3u8 is encrypted, and can be played with the native MediaPlayer in android on my MOTOROLA XT875.
I searched for the error info, and find thisErrors videos not played -- Vitamio.
So, does vitamio really support the encrypted HLS streaming?
Thank U Palejandro! However, according to Vitamio Docs, the latest SDK v4.2 supports the encrypted HLS. Support AES-128 encrypt for HTTP Live Streaming. So, the answer is yes.
Maybe, the problem has something to do with the different SDK version or other issue. I fixed this problem by just testing it on another cell phone...
Vitamio's website: Vitamio feautes not support says:
Doesn't support encrypted videos (such as DRM), embeded m3u8 (if in m3u8 including video links cann't be played, then vitamio will stop playing video, not skip).
so, the answer to your question is unfortunately no.
If you want to play encrypted HLS in android devices, you can create something like local server in your phone, which will download and decrypt encrypted .ts files and then create your own m3u8 playlist for mediaplayer
I'm working on a native Android application that streams HLS video. I'm trying to get CEA-608 closed caption data to display, but I'm running into a problem.
Methodology:
I'm running on a Jelly bean device (API 4.1+), which supports closed captions and HLS playback (http://developer.android.com/about/versions/android-4.1.html#Multimedia).
Test Feed:
I'm testing using the Apple sample HLS bip-bop feed that contains captions data (https://devimages.apple.com.edgekey.net/resources/http-streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8)
Grabbing Caption Data:
As per the Android documentation, I'm attempting to get the caption track by calling:
"MediaPlayer.getTrackInfo()"
Problem:
The player crashes when I execute the getTrackInfo() line, with the following output in LogCat:
E/AndroidRuntime(7311): FATAL EXCEPTION: main
E/AndroidRuntime(7311): java.lang.RuntimeException: failure code: -38
Questions:
1) Is closed caption rendering from in-stream caption data on an HLS feed supported in native Android apps?
2) If not, are there alternatives?
3) The documentation in the link above (quoted below) indicates that in-stream captions are supported on MP4 or 3GPP media sources. Does that necessarily exclude HLS (which I believe is MPEG-2 based) from working?
The MediaPlayer now handles both in-band and out-of-band text tracks.
In-band text tracks come as a text track within an MP4 or 3GPP media
source. Out-of-band text tracks can be added as an external text
source via addTimedTextSource() method. After all external text track
sources are added, getTrackInfo() should be called to get the
refreshed list of all available tracks in a data source.
Thanks for any help you can offer!
We went thru exactly same exercise. MediaPlayer on Android doesn't seem to support CEA-608 embedded in HLS. OnTimedTextListener was never called when media player (MP) was playing. On trying to call getTrackInfo() when MP was playing resulted in crash as you mentioned.
May be Android MP can decode only included SRT in MP4.
Alternative would be to use external timed text track but in live streaming environment, it is going to be difficult.
The question is quite old, but some people still might face the problem.
ExoPlayer tries to solve the issue as an Android version independent general multimedia library.
It currently supports CEA-608, SubRip, TTML, TX3g and WebVtt subtitles. Of course not fully all the standards, but a useful part of them.
We have enabled multicast streaming in one of our machines using VLC server. We use the following URL for streaming the multicast data.
rtp://239.1.2.11:5004 & udp://239.1.2.11:1234
But when we pass these links to the VideoView or mediaplayer in android, we get the message as "Sorry, the video can not be played".
Is it the case that multicast streaming is not supported in android? (Though multicastsocket class is present in library) or are we missing anything?
The links play well on the VLC client so we don't think there is any issue in VLC server.
We are using android v2.3 for development.
I am not at all an expert in video encoding, but I think the problem is not with the streaming, I think it is with the encoding of your videos. You should have a look at Android Supported Media Formats and make sure that your video encoding,format,resolution meet the recommendation specified there.