Can anyone tell me if the Android MediaPlayer class is able to play a video stored in a remote URL?
Just for testing purposes, can I use the URL http://localhost/video-name.3gp.
Can anyone tell me if the Android
MediaPlayer class is able to play a
video stored in a remoted URL?
Yes, if the video is safe for streaming.
Just for testing purposes, can I use
the URL
http://localhost/video-name.3gp
No. localhost is going to be the emulator itself.
Another question is if the MediaPlayer
works well on the emulator?
Only if you have a fairly fast machine, and not for streaming. You absolutely need hardware to test streaming video.
Ans:- Yes
create a media player object
Mediaplayer ob=mediaplayer.Create(mediaplayerActivity.this,file);
ob.start();
ob.play()
Related
I have an android application for live streaming and recording from a hardware device through wifi. The hardware device can store images and video within the hardware and we can transfer these videos to our mobile application. I am getting the videos and able to download it to my mobile memory. But The video received in .mts fomat and unable to play it using android native MediaPlayer class. I would like to ask you is there any method/library available to play .mts videos . Thanks in advance
Default native MediaPlayer does not support the .mts file format. Better you use vitamio library for that. refrence link - https://stackoverflow.com/a/8261864/3912847 & https://karanbalkar.com/2014/11/tutorial-92-live-streaming-using-vitamio-in-android/
You can download the vitamio library form here
My question is about media player live streaming from the url in my application?
I'm trying to play live stream mp3 audio by media player.
The problem is that when i am using default URL as given in this link , then it works fine. But i changed the following mp3 link ,
then after playing 1 seconds it taking buffering and after completion its play the song, but i need that it plays the song with the buffering as well.
please help.
Thanks in advance.
It is not easy task to accomplish.
You can use this link https://code.google.com/p/mp3tunes/source/browse/
as reference app to develop your own progressive mediaplayer app.
From the above link you will get the whole architecture for your app.Song downloading and playing is happens at the same time.The architecture developed in the reference app is more robust and reusable.
Specially look at following classes
NanoHTTD.java
HttpServer.java
PlaybackService.java
PlaybackQueue.java
TrackDownloader.java
Thank You.
I am a new bee in android application, here is the brief of my problem, I am creating an application where I need to get video from internet and stream in the device default players.
Note: I don't want to download entire video and play,I need something relevant to live streaming into the default players on the device.
Any idea or way how to start would be greatly appreciated.
Kind Regards,
Rojesh.
VideoView has a method setVideoPath(path) where the path can be also an HTTP URL.
I have just referred to the PhoneGap Documentation for Media, which stated:
"The Media object provides the ability to record and play back audio files on a device."
I wonder whether video streaming (RTSP) is possible or not with PhoneGap framework? I am trying this out on Android.
Any suggestions highly appreciated.
Yes, streaming to the device is possible.
Just like with a normal website/webapplication.
I don't know if it's done yet, but this is a audio stream script:
http://www.joeldare.com/wiki/play_an_mp3_audio_stream_in_phonegap
I hope that will get you started.
EDIT:
Maby this will also help you to get started:
http://groups.google.com/group/phonegap/browse_thread/thread/584028fe07b0c869/47a1af617c94540a?#47a1af617c94540a
Simply the streaming video can be opened up in a child browser or in App browser to play the video. This solution will work both on Android as well as iOS.
Also if the streaming will be opened in the browser it will appear in full screen mode as q media player will play the video on safari.
Hope this will help.
Hello I am currently new to android development I been working on the examples in the Dev Guide in the android website. I want to get a stream from a server I have to play in the emulator when I insert the url it doesn't seam to want to play. My question is there a way to get the emulator to play audio or is it all enabled also does MediaPlayer require a special kind of format like mp3 or ogg ?
This is the code i am running on my 'onCreate()' method.
MediaPlayer mp - new MediaPlayer();
mp.setDataSource(MY_URL_);
mp.prepare();
mp.start();
Hope you guys can help my out.
The code is correct, it works on my device and it doesn't work on emulator. So I guess you need device to hear the sound.
You used to be able to set a flag "-useaudio" in the command build scripts, but now it seems the emulator won't play sound, or at least mine won't.