I'm trying to create a simple video player with 3 buttons: play, stop and pause. My video will be from the raw folder or at a server url that I will upload it to. Do you have any tutorial on this in order to get some ideas? Also, I have created a media player with a song, but I think that this can't work for videos, right?
There's a project sample in the SDK for the VideoView. You can attach a MediaController to it, which will show you play/pause stop and skip buttons. It's also on the developer website, here.
this may be what you are looking for: http://davanum.wordpress.com/2009/12/04/android-%E2%80%93-videomusic-player-sample-take-2/
To make this more abstract, the VideoView Widget is what you need.
Related
Which library is useful to load audio or video file from API and play to the application? I tried glide for the image. But no idea about audio or video. (I want to fetch the image and file name to the recycle view after click operation file will play to the next activity.) A short guideline with library name is very helpful.
Android has MediaPlayer to load and play Audio and Video from URL. you can setDataSource as URL.
refer this answer...
You have Two approach one of them is using official Library (Media Player Library for music and VideoView for video) and other approach is using custom library I suggest you to using ExoPlayer Library for playing music and video
you can use following link:
https://github.com/google/ExoPlayer
I want to play a remote video in a Videoview. Anybody knows a good free server to load my videos in it to later stream in a videoview? Is possible to see in a videoview Youtube videos? I have see another questions but I donĀ“t understand. Anybody can put a example to play a Youtube video or remote video for another server in a videoview?
Thank you
You can check android-youtube-player, a project to make YouTube videos play in a VideoView. The usage instructions and sample Activity code is available.
You can definitely stream video directly into a VideoView without a problem, and you set it up normally as well:
Uri pathtoVideo = Uri.parse(path);
videoView.setVideoURI(pathToVideo);
However, there are a lot of videos on Youtube that aren't mobile-friendly, and will end up throwing a "This Video Cannot Be Played" error.
The MediaPlayer on Android can only play "progressive streamable contents" which basically means: 1. the movie atom has to precede all the media data atoms. 2. The clip has to be reasonably interleaved. If it doesn't, you'll get the error I mentioned above.
Have you considered the YouTube API for android? I recently posted a tutorial on how to use the video and thumbnail views from the API here
Is there any way to get music Image like what built in android media player do .
for example ,open a music , if music has image, media player shows it is image as background .
where can I find that image ?
This is found in the MetaData of the file itself. You should be able to find it pretty easily if you know how to navigate the database content.
http://developer.android.com/reference/android/provider/MediaStore.html
In mp3 Id3 tags. Example here.
I am trying to make an app that allows me to stream a video from a website and play that video in my app.
However, I would like to play this video from my app and not through youtube or anything else.
So you click a button and a video starts streaming and stays in my app and plays. Also, another quick question here, can I play videos from anywhere?
I think I read that it had to be .mp4 or something but im not sure. How can I tell if it's .mp4 by just looking at it?
If I really want to play a video that isnt .mp4 (or whatever it's supposed to be) is there any way at all that I could possibly play it?
The quickest way is to have a view dedicated to a Flash player which streams the video for you. You can generate the HTML at runtime and pass it into a WebView.
This is probably not what you are looking for because you mention that you want it to stream directly with Android. I thought I would put the suggestion out there though.
Edit:
You would use a WebView. Using the following function:
loadDataWithBaseURL(baseUrl, data, mimeType, encoding, historyUrl);
You pass in a base URL, which in this case can just be file:///android_asset/ and the data is your complete HTML code. etc.
The data would be set like so:
String data = "<html><head></head><body>flash player goes here</body></html>";
You would set the Flash player to occupy the whole screen, so that the size of the player is then determined by the size of your WebView.
I have referred the answers of
android-youtube-app-play-video-intent
how-to-play-youtube-video-in-my-android-application
and many more.All those are playing videos by using Intent which creates a new Window and to be more precise by creating a new Activity.
But,I am having a scenario in which I want to play a Video on click of a Button by staying in the same Activity
refer this video tutorial:
http://mfarhan133.wordpress.com/2010/10/13/using-audio-video-files-tutorial-for-android/
Use a VideoView
http://developer.android.com/reference/android/widget/VideoView.html
If you want to play a video file from phone storage or streaming, you can use VideoView.
If you want to open youtube video, you can use a WebView in your activity and open the youtube link.
See this WebView Tutorial.