We are trying to develop an app for Android where you can play a live streaming URL. I tried several approaches using the MediaPlayer and StreamPlayer... but no luck with the URL playing.
I can of cause play a static MP4 or MP3 file using the URL (hosted on a server) but when I try to play a stream URL it doesn't play or give an error.
Any thoughts?
Mp3 stream works well on Mediaplayer from Android 2.2 and above. If you want to play the Content below 2.2 then its better to use local proxy server implementation. check Npr . Which uses the same approach.
If you want to play wma audio you should convert that into PCM and play it. check aacplayer. In aacplayer project he gets wma content from mms:// stream and plays it . You can edit that to play only wma content. But i haven't tried playing any wmv videos.
Related
I'm trying to play a video from the Internet in my app, but the video with a definition higher than 360p returned an .flv url. I have no idea to play it. Can someone suggest me some ways or a library?
PS: I need to set some headers to get the stream
How to stream .mp4 video in android, video is from backed server. By implementing all the solution showing a message can't play this video
My suggestion is to use Exoplayer which is google's video default player.
here is a very basic, working example of exoplayer 2.8.4 to play livestream or .mp4 files.
https://github.com/ayalus/ExoPlayer-2-Example
i'm trying since a few days to play Youtube rtsp streams in my Android app,
but only get Errors from Android MediaPlayer instance - unable to open file.
I've tried to open 3gp files, it can play. Tried to open other rtsp streams found
around the internet - all can play, but Youtube dont.
Tested the video urls in Windows VLC player - the player cant play a YOutube video
streamed with rtsp protocol.
Is there something wrong with YT rtsp streams so no player can play that Urls?
Thanks for a small hint what can i try to do ;)
I mean I have a link like this: http://15....../a.stream
I write this code to see the video on android :
VideoView wv = (VideoView)findViewById(R.id.videoView1);
wv.setVideoURI(Uri.parse("rtsp://15........./a.stream"));
MediaController controller = new MediaController(izle.this);
wv.setMediaController(controller);
wv.start();
This code works first.But one day the same code say :
Cannot play video
Sorry,this video cannot played.
My first question is why that alert me like that?
second question is maybe i play video in another way maybe it is work.Like if I play video in webview maybe it is work? How I play the rtsp video stream on webview?
Thanks...
You can't play rtsp in webview. Only Flash(rtmp) stream play in browser with flash player.If streams is rtsp, then browser will open it in the external video player.
HTTPS progressive streams are only supported under 3.0+.
WebView plays rtmp as well as rtsp if your device has somehow flash working on it. It won't play without that so API version is important because flash player used to work on earlier APIs.
The best way to stream live in Android is to use Vitamio. It's the best solution out there. It can play numerous stream formats including rtmp and rtsp.
I have a project with a VideoView in it I am streaming a video from online using this method:
mVideoView.setVideoURI(Uri.parse("http://db.tt/ij7w1Nw"));
My videos are mp4 files downloaded from Youtube. I then upload them to my dropbox, that is where the url comes from. This works fine if I download the video and do not make any changes to it, and upload it straight to dropbox. However if I try to make any changes to it for instance convert from .flv to .mp4, or change the size, then I upload it to dropbox it no longer plays in the VideoView. I get a dialog that says 'Unable to play video. Invalid streaming data'. If I take this same exact video and put it on the SD card either manually or even by having my app download it from the url then play it off of the SD card using
mVideoView.setVideoPath(path);
it works fine. I am using Wondershare Video Converter Platinum to do the conversions and size changes.
Is there some sort of specific encoding that is required to stream an mp4 file rather than play it from a local copy? Am I getting this because of some sort of bug/error with wondershare? Has anyone else experienced this type of problem, if so how did you end up fixing it.
Thank you.
The media format guide may help you see what's available. In my experience wrapping a H.264 AVC or MPEG 4-encoded video in a 3GPP container provides the easiest integration. Android is very fickle with both audio and video streaming.