I am developing an android application which requires a youtube video player embedded within it. I successfully got the RTSP video URL from the API, but while trying to load this rtsp url in my android video view, it says 'Can't play this video.
'. Previously I developed a similar application in this method, and it worked fine at that time, but it also failing to load now.
// initiate a video view VideoView simpleVideoView = (VideoView) findViewById(R.id.simpleVideoView); simpleVideoView.setVideoURI(Uri.parse('android.resource://' + getPackageName + '/' + R.raw.fishvideo)); Setting Video From Online Web Source: Step 1: First add internet permision in Manifest.xml file. We will need to add this so as to access the video through Internet. I am trying to develop an Android based application, which can play video from a live stream. This live stream is produced using Wowza Media Server. The URL is: rtsp://tv.hindiworldtv.com:1935/live/. Hi I am using an IP camera with wifi and I am streaming the RTSP video to a videoview. Does anyone know how to capture an image from the live stream. I have tried getting the frame from media player and it was giving a distorted bitmap. How can I take a picture from the live preview. Captured image has to go through image processing.
I'm sure about that, I'm getting the correct RTSP url from the API. rtsp://v6.cache6.c.youtube.com/CiULENy73wIaHAlV9VII3c64lRMYESARFEgGUglwbGF5bGlzdHMM/0/0/0/video.3gp
Here is my activity code:
EDIT
Found some additional information from the logcat:
Unlocker download windows 7 32 bits. Please suggest me a way to load youtube videos in android video view.
Thanks in Advance…
EDIT
Just checked in another device, HTC Desire (2.2). The code worked fine.
Mailstyler 2 pro. I'm wondering about thinking, What will be the problem with Nexus (4.1)??
As I can't find any way to load the rtsp URL in video view (for all devices & android versions), I solved my problem with another work around. I used a webview to embed the youtube player within it, and this method working nicely in all tested devices.
Here is my code:
Thank you very much for all your help guys.
Due to current version of YouTube you are likely to get a 'Can't play this video' error if you will use VideoView
to show your video.
Take a look at this approcach with YouTubePlayerView
:
http://xinyustudio.wordpress.com/2014/03/17/android-development-play-youtube-video-in-your-app-cant-play-this-video-and-troubleshooting/
Checkout this link . It explains how to implement youtube video in VideoView.
Use YouTube Android Player API. It works perfectly. Check my example from here:
activity_main.xml: Latest version of omnisphere.
MainActivity.java:
and the PlayerConfig.java class:
Replace the 'Hce74cEAAaE' with your video ID from https://www.youtube.com/watch?v=Hce74cEAAaE. Get your API_KEY from Console.developers.google.com and also replace it on the PlayerConfig.API_KEY. For any further information you can follow the following tutorial step by step: https://www.youtube.com/watch?v=3LiubyYpEUk
Using Video View:
1.Code in the layout xml:
Android Rtsp Server
2.Code in java class:
We set the VideoUri by specifying the 3gp link of Youtube video for mobile platforms. To add media controls such as Play, Pause, Rewind, Fast Forward and a progress slider ,we add MediaController to the VideoView.
uri.parse( 3gp link of the video )…you can get this from youtube
EDIT
Just checked in another device, HTC Desire (2.2). The code worked fine.
Mailstyler 2 pro. I'm wondering about thinking, What will be the problem with Nexus (4.1)??
As I can't find any way to load the rtsp URL in video view (for all devices & android versions), I solved my problem with another work around. I used a webview to embed the youtube player within it, and this method working nicely in all tested devices.
Here is my code:
Thank you very much for all your help guys.
Due to current version of YouTube you are likely to get a 'Can't play this video' error if you will use VideoView
to show your video.
Take a look at this approcach with YouTubePlayerView
:
http://xinyustudio.wordpress.com/2014/03/17/android-development-play-youtube-video-in-your-app-cant-play-this-video-and-troubleshooting/
Checkout this link . It explains how to implement youtube video in VideoView.
Use YouTube Android Player API. It works perfectly. Check my example from here:
activity_main.xml: Latest version of omnisphere.
MainActivity.java:
and the PlayerConfig.java class:
Replace the 'Hce74cEAAaE' with your video ID from https://www.youtube.com/watch?v=Hce74cEAAaE. Get your API_KEY from Console.developers.google.com and also replace it on the PlayerConfig.API_KEY. For any further information you can follow the following tutorial step by step: https://www.youtube.com/watch?v=3LiubyYpEUk
Using Video View:
1.Code in the layout xml:
Android Rtsp Server
2.Code in java class:
We set the VideoUri by specifying the 3gp link of Youtube video for mobile platforms. To add media controls such as Play, Pause, Rewind, Fast Forward and a progress slider ,we add MediaController to the VideoView.
uri.parse( 3gp link of the video )…you can get this from youtube
It depends on which Video codec format you are recieving your rtsp. There are certain devices which do not support running .mp4 file. Go through Android Media support for more information. Check if you can play any other .3gp files or not.
Android Mediaplayer Rtsp
Tags: android, video, view