I got a problem related to playing videos based on Url i get. I made 2 cases, but each one has its problem.
1) using android VideoView
videoPlayer.setVideoURI(Uri.parse(videoUrl));
videoPlayer.setMediaController(new MediaController(this));
videoPlayer.requestFocus();
videoPlayer.start();
The problem is that it doesn't open such types of video url
https://www.facebook.com/zloishkolnik/videos/462625797256094/
https://www.youtube.com/watch?v=YVkUvmDQ3HY
2) using android WebView
videoPlayer.setWebViewClient(new WebViewClient());
videoPlayer.getSettings().setJavaScriptEnabled(true);
videoPlayer.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
videoPlayer.getSettings().setPluginState(WebSettings.PluginState.ON);
videoPlayer.setWebChromeClient(new WebChromeClient());
videoPlayer.loadUrl(videoUrl);
Webview opens the links above, but doesnt open such type of links
http://www.db.cartosnet.com/videos/EU5beThfNI.mp4
Am i doing something wrong or there is any library that reads any video url given?
To play videos through your way (setting a url to Videoview), your endpoint must be the video as itself. Example of a valid endpoint: https://ia600404.us.archive.org/1/items/popeye_patriotic_popeye/popeye_patriotic_popeye_512kb.mp4
If you want to play videos, in your case, embedded videos, you should use a API (like Youtube, Facebook...)
Related
Is it somehow possible, you can load the movie trailers from imdb to videoView or the native android player.
so far, what i've tried.
Iframe approach which let me load trailer in webview, which is exactly i don't want.
Here i found a link which is something a direct link to stream.
I want this to play in video view or native android control.
thanks in advance.
The link you have above is not a direct link to the video - it is actually a link to a web page which contains an embedded player, which in turn has a link to the actual trailer video itself.
You can see the link the to the video if you use the network timeline tab in a browser inspector to look at the network requests. For your example above the client (the browser running the HTML5 page you have downloaded) is requesting the video m3u8 file with the following request:
http://imdb-video.media-imdb.com/vi1225109529/1421100405014-mxwp62-1434643350557.m3u8
This is the 'index' file for a HLS format video file - it tells the client where to request the video streams. The client then downloads the video chunk by chunk which you can see as requests for TS segments - e.g. for you example above:
http://imdb-video.media-imdb.com/vi1225109529/1421100405014-mxwp62-143464335055700002.ts
If the IMDB site does not protect or restrict the video in some way (for example only allowing it play from their embedded web page) then in theory Android should be able to play a HLS file if you point the Media Player towards the m3u8 file. In practice however Android has well know issues with HLS playback so you may find it problematic - see this summary: http://www.jwplayer.com/blog/the-pain-of-live-streaming-on-android/
I need access to media controls of video player embedded in webview html page. Webpage is a client web page and cannot be modified to achieve javascript interaction.
Basically I need the video download url, tried using shouldOverrideUrlLoading() of webview client, it doesn't work for flash players on webpage.
If you play the video in videoview then you can control using mediaPlayer.
But in case of videoPlayer embedded in webview I don't think you'll have access to control the player.
I am working on an Android application. In my app I have to play videos in VideoView. The videos from the Vimeo is not working. Whenever I tried to load Vimeo video I am getting the error message:
"sorry, this video cannot be played".
I saw some of the similar discussions in StackOverflow. So I tried Vittamio demo. There also Vimeo videos are not playing.
In the case of youtube url we have to convert to RTSP. for example
http://www.youtube.com/watch?v=Jx3pdWBlZ34
will convert to
rtsp://v4.cache8.c.youtube.com/CiILENy73wIaGQl-Z2VgdekdJxMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp
I gave sample url is like this.
private String path = "http://player.vimeo.com/video/49462103 ";
and
private String path = "http://vimeo.com/49462103";
Is this the right way to enter Vimeo url in Android
Please help me to fix my issues friends.
Vimeo provides PRO members access to their own source files via the new API3.
They are available on every video response, under the files key. You can get video responses by requesting a specific video (single video: /videos/{video_id}) or by requesting a collection of videos (your videos: /me/videos).
You can learn more about the api here: https://developer.vimeo.com/api/start
Now this is a really stupid one! Forgive me on this question please but I really don't know the answer to it. My question is What have Youtube used to play videos intheir Android app? I mean is it a WebView or Just a simple VideoView? I used VideoView to play videos from the URL associated with them but it doesn't look as nice as YouTube's VideoView (or whatever it is)
And is there any other option to play videos from a URL other than using the code below? Because it just plays video in the native video player. If the red-marked portion in the image below is a VideoView, how does it look better than the normal VideoView? Or is it a WebView? Which one is a better option (in terms of UI) to play video from a URL? I'm using GingerBread and want to play mp4 or .flv videos in a VideoView or WebView (whichever is the better option, preferably like Android's YouTube app)
Uri data = Uri.parse(movieurl);
intent.setDataAndType(data,"video/3gpp");
startActivity(intent);
I am launching the MediaPlayer to play a .mov file that is being passed into the MediaPlayer as a Uri (which is standard). However, it is telling me that it cannot play the file. However, if I put this same link on the web, and the click the link to launch the movie (while in my Android browser) the video plays no problem. However, I can't get the WebView to play it with the Video tag despite all my efforts.
So here is my question, what magic is taking place that allows an android browser app to take a .html url which contains a link to play a video and play it? If I load the same url in a WebView, or try to pass the video url into the mediaplayer, it is a no go. The format of the video is .mov.
Thanks in advance to everyone.
The Android browser and WebView are very different, WebView is very barebones as it was designed expecting people to use it for very basic showing html webpages. WebView by default has no plugins enabled, no javascript enabled and so on and so on. Never expect that because something works in the browser that it will work in a WebView.
Now in regards to how the media is handled. The Browser has extra features set up to strip the video source from the page and launch it in the native player most of the time. This functionality is not built into WebView. And the native player is very picky about what needs to passed into it as a URI to be able to play it.
Hope that helps,
Stevy888