play video from web

All your problems with Audio, Video and Images.

play video from web

Postby achie1266 » Wed Dec 30, 2009 7:11 pm

Hi everyone,

I need to play you tube videos and right now I have a list where I display the image and title of the videos.

Now as the user clicks on the video button, I want to be able to open the video and play it just like the it does it when we play videos from youtube.

please let me know how to do this if you have an idea.

thank you.
achie
User avatar
achie1266
Master Developer
Master Developer
 
Posts: 223
Joined: Mon Nov 09, 2009 10:56 pm
Location: Denver

Top

Postby achie1266 » Wed Dec 30, 2009 7:54 pm

So I followed the tutorial in the sdk and did this.
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class VideoEx1 extends Activity{
  2.  
  3.         private final String VIDEO_URL = "http://www.youtube.com/watch?v=booKP974B0k";
  4.         private VideoView mVideoView;
  5.  
  6.         public void onCreate(Bundle savedInstanceState){
  7.                 super.onCreate(savedInstanceState);
  8.                 setContentView(R.layout.video_main);           
  9.                 mVideoView = (VideoView) findViewById(R.id.surface_view);
  10.  
  11.         if (VIDEO_URL == "") {
  12.             Toast.makeText(
  13.                         VideoEx1.this,
  14.                     "Please edit VideoViewDemo Activity, and set path"
  15.                             + " variable to your media file URL/path",
  16.                     Toast.LENGTH_LONG).show();
  17.         } else {
  18.             mVideoView.setVideoURI(Uri.parse(VIDEO_URL));
  19.             mVideoView.setMediaController(new MediaController(this));
  20.             mVideoView.requestFocus();
  21.         }
  22.         }
  23. }
Parsed in 0.034 seconds, using GeSHi 1.0.8.4
Here is my layout.
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2.         android:id="@+id/video_main_layout"
  3.    android:orientation="vertical"
  4.    android:layout_width="fill_parent"
  5.    android:layout_height="fill_parent"
  6.    >
  7.     <VideoView
  8.        android:id="@+id/surface_view"
  9.        android:layout_width="320px"
  10.        android:layout_height="240px"
  11.    />
  12. </LinearLayout>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4
When I run this code it displays a dialog saying "cannot play video" and in logcat it gives me this error
E/PlayerDriver( 31): Command PLAYER_INIT completed with an error or info PVMFErrCorrupt
E/MediaPlayer( 281): error (1, -10)
E/MediaPlayer( 281): Error (1,-10)
D/VideoView( 281): Error: 1,-10
W/PlayerDriver( 31): PVMFInfoErrorHandlingComplete
I do not have any idea of what this error means and could not get much help even after searching.
So if anyone knows why this is happening and how to solve this please let me know.

Thank you.
achie
User avatar
achie1266
Master Developer
Master Developer
 
Posts: 223
Joined: Mon Nov 09, 2009 10:56 pm
Location: Denver

Re: play video from web

Postby singalashok » Wed May 26, 2010 11:05 pm

Hi archie,

Were you able to fix the error that you have mentioned because i am facing the having the same error message and am stuck at this point?

would really appreciate if somebody please help me to fix this error?
Thanks.
Ashok
singalashok
Freshman
Freshman
 
Posts: 4
Joined: Wed May 26, 2010 11:00 pm

Re: play video from web

Postby shubh » Wed Dec 01, 2010 11:35 am

Hi friends,
Thnx but anybody have any idea about how to play video in webview in Android.

Pls suggest me how can I do this .
Thank in Advance
User avatar
shubh
Experienced Developer
Experienced Developer
 
Posts: 83
Joined: Tue May 18, 2010 7:17 am
Location: India

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: Google [Bot], Google Feedfetcher and 23 guests