Rui Gonçalves
Rui Gonçalves

Reputation: 2443

Use Android MediaPlayer class to play a video from a URL

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.

Upvotes: 2

Views: 2612

Answers (2)

Sahadev Tarei
Sahadev Tarei

Reputation: 1

Ans:- Yes

create a media player object

Mediaplayer ob=mediaplayer.Create(mediaplayerActivity.this,file);
ob.start();
ob.play()

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1007534

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.

Upvotes: 3

Related Questions