i want play video stream Format m3u8 with Exoplayer and vitamio but fail.url stream in link enter link description here . Give me the solution .
Thank u
Code play exoplayer me :
try {
emVideoView.setOnPreparedListener(ExoActivity.this);
emVideoView.setVideoURI(Uri.parse("" + stream));
emVideoView.setOnErrorListener(new OnErrorListener() {
#Override
public boolean onError() {
return false;
}
});
} catch (Exception e) {
}
Related
I am trying to stream to my Android Application from an IP Webcam over RTSP, the stream plays successfully via the VLC Android app, but I cannot replicate this in my own application.
if (mediaControls == null)
{
mediaControls = new MediaController(VideoActivity.this);
}
myVideoView = (VideoView) findViewById(R.id.stream);
myVideoView.setOnErrorListener(this);
progressDialog = new ProgressDialog(VideoActivity.this);
progressDialog.setTitle("Camera Stream");
progressDialog.setMessage("Loading...");
progressDialog.setCancelable(false);
//progressDialog.show();
try
{
myVideoView.setMediaController(mediaControls);
myVideoView.setVideoURI(Uri.parse(videoSrc));
}
catch (Exception e)
{
Log.e("Error", e.getMessage());
e.printStackTrace();
}
myVideoView.requestFocus();
myVideoView.setOnPreparedListener(new OnPreparedListener()
{
// Close the progress bar and play the video
public void onPrepared(MediaPlayer mp)
{
//progressDialog.dismiss();
myVideoView.seekTo(position);
if (position == 0)
{
myVideoView.start();
}
else
{
myVideoView.pause();
}
}
});
The activity prompts a "Cannot Play This Video" dialog. According to the Desktop VLC client the stream is MJPG, 320x256, displaying at 320x240, in the decoded format "Planar 4:2:0 YUV full scale." According to the camera's data sheet it is at 30fps.
I have been able to play other RTSP streams with this code, but not the one I need.
I have been trying to figure out how to use libVLC but haven't had much luck so far. Can anyone help me to get this stream into something my application can use?
Our APP has to stream music from network source. My question is why the mediaplayer play well when I play music using http stream, but I always got ERROR(1,-1004) when I use https stream source to play in some devices. **Important:**It only got this ERROR(1,-1004) in some devices, such as Nexus5, Nexus7 and Asus Fonepad 7.
Here is a snippet :
String url ="http://10.0.0.45/O0$1$8I87308.mp3";
MediaPlayer myMediaPlayer = new MediaPlayer();
myMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
try {
myMediaPlayer.setDataSource(url);
myMediaPlayer.prepareAsync(); // might take long! (for buffering, etc)
} catch (IOException e) {
Toast.makeText(this, "mp3 not found", Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
//mp3 will be started after completion of preparing...
myMediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
#Override
public void onPrepared(MediaPlayer player) {
player.start();
System.out.println("onPrepared");
}
});
I'm trying to play an rtsp stream using MediaPlayer in android and the application seems to always become stuck on MediaPlayer.prepare();
The url is valid as I tested it using VLC on my desktop.
Any ideas why the application is not preparing the stream.
class InitializeService extends Thread {
#Override
public void run() {
try {
player.prepare();
Log.d("Play", "Player prepared");
} catch (IOException e) {
e.printStackTrace();
fallback();
} catch (IllegalStateException e) {
e.printStackTrace();
fallback();
}
}
}
The log statement is never reached.
Update 1:
Sorry I forgot to mention that the stream will always be in 3gp format. Here is a url rtsp://r2---sn-p5qlsu76.c.youtube.com/CiILENy73wIaGQnTXOVs7Kwo8xMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp
Your stream might not be of a format supported by Android.
Check http://developer.android.com/guide/appendix/media-formats.html to see if Android supports it.
Turns out it was android l that wasn't able to play the streams.
I am playing video from url then .mp4 in playing but .mov format is giving IOException
java.io.IOException: Prepare failed.: status=0x1
My code for playing video is,
private void playVideo() {
if (extras.getString("video_path").equals("VIDEO_URI")) {
showToast("Please, set the video URI in HelloAndroidActivity.java in onClick(View v) method");
} else {
new Thread(new Runnable() {
public void run() {
try {
player.setDataSource(extras.getString("video_path"));
player.setDisplay(holder);
player.prepare();
} catch (IllegalArgumentException e) {
showToast("Error while playing video");
Log.i(TAG, "========== IllegalArgumentException ===========");
e.printStackTrace();
} catch (IllegalStateException e) {
showToast("Error while playing video");
Log.i(TAG, "========== IllegalStateException ===========");
e.printStackTrace();
} catch (IOException e) {
showToast("Error while playing video. Please, check your network connection.");
Log.i(TAG, "========== IOException ===========");
e.printStackTrace();
}
}
}).start();
}
}
Any pointers?
Please visit the website vitamio.org or download VitamioDemo from github github.com/yixia/VitamioDemo
if you want to use Vitamio as your video player in an app, you need to download the Vitamio SDK from their website. Play around with the demo project and you'll understand how it works.
I have implemented the same and it works absolutely fine with me.
.mov files are not supported in android.
Check the Supported Media Formats on developers site.
I have online radio (shout cast ) in web. I want to develop android app for listen this stream. so I want to know how to play online stream in android. using URL. In Android Im not going to Stream the audio. I want listen the web stream from android app.
How to do that..?
thanks
Something like
private void init() throws IOException {
try {
mediaPlayer = new MediaPlayer();
String streamPath = "";//enter path
mediaPlayer.setDataSource(streamPath);
mediaPlayer.prepare();
} catch (MalformedURLException ex) {
throw new RuntimeException("Wrong url for mediaplayer! " + ex);
} catch (IllegalStateException ex) {
} catch (IllegalArgumentException ex) {
throw new RuntimeException("Wrong url for mediaplayer! " + ex);
}
}
private void play() {
mediaPlayer.start();
}
Please refer the link it may help you a while, http://developer.android.com/guide/topics/media/index.html