How to play youtube videos within custom android activity

by sanjay » Tue, 04 Jan 2011 13:49:29 GMT


Sponsored Links
 Hi,

I am able to play youtube videos by

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://
www.youtube.com/watch?v=cxLG2wtE7TM")));

But this leave my application and starts the player activity where I
have no control, How can I play youtube videos within my activity, as
I have to provide the user some option menu?

Let me know how can I achieve this.

Thanks
Sanjay Ujjainkar

-- 



Re: How to play youtube videos within custom android activity

by Kumar Bibek » Tue, 04 Jan 2011 15:42:14 GMT


 You need to understand first that youtube videos are generally in flv
format, and the SDK doesn't provide default decoders or apis to handle
such media. If you have to create your own player, then you have the
tough task of converting the flv files to other supported media and
then continue.




-- 


Sponsored Links


Re: How to play youtube videos within custom android activity

by Jonathan Foley » Tue, 04 Jan 2011 17:09:17 GMT


 Huh? All the mobile youtube apps that aren't flash native are pulling
down h264 video.

So the trick is not converting them, but rather figuring out what the
links are to those h264 videos. It may be special keys are required,
but there are some HTML5 demo sites floating around that have
javascript that pulls down those h264 videos, so people have figured
out how to get them. You can't request them via the YouTube API, which
is pretty strange, but all the youtube download scripts pull them
down.

Jonathan






-- 



Re: How to play youtube videos within custom android activity

by Sohil » Tue, 04 Jan 2011 20:48:24 GMT


 Hi,

Try using <video> element of HTML5, though its experimental. but it will 
help for your problem
put the webview component and load the static file with dynamic url to 
webview.
It wont work for all the video that would be the limitation.
Its supported in android 2.0+ .

<video id="video" autobuffer height="240" width="360">
<source src="BigBuck.m4v">
<source src="BigBuck.webm" type="video/webm">
<source src="BigBuck.theora.ogv" type="video/ogg">
</video>




-- 



Re: How to play youtube videos within custom android activity

by Sudheer » Wed, 05 Jan 2011 03:47:02 GMT


 You can create a custom Activity with a Webview on it. You can load
the youtube on the webview. My 2 cents.

Cheers
Sudheer




-- 



Re: Re: How to play youtube videos within custom android activity

by Kumar Bibek » Wed, 05 Jan 2011 03:49:44 GMT


 Yeah, but it wont play on all phones though, which don't have flash.

Kumar Bibek
 http://techdroid.kbeanie.com 
 http://www.kbeanie.com 








-- 



Re: Re: How to play youtube videos within custom android activity

by satishsalimath salimath » Fri, 07 Jan 2011 13:34:15 GMT


 download youtube downlloader right click on video copy url and paste it in
downloader and viw it on real one player
With Regards
Satish.S






-- 



Other Threads

1. Is it possible to launch another app's main activity just by changing manifest.xml?

Hi,

 I've 2 applications.
~~~~~~~~~~~
manifest.xml for app1
~~~~~~~~~~~
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.mytest.android.hellotest"  android:versionCode="1"
android:versionName="1.0.0">
    <application android:icon="@drawable/icon" android:label="@string/
app_name">
        <activity android:name=".HelloTest"  android:label="@string/
app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
</manifest>


~~~~~~~~~~~
manifest.xml for app2
~~~~~~~~~~~
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.mytest.android.testapp" android:versionCode="1"
android:versionName="1.0.0">
    <application android:icon="@drawable/icon" android:label="@string/
app_name">
        <activity android:name=".TestApp"  android:label="@string/
app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
</manifest>
===========================
I'm trying to do the following.

When I launch app1, instead of starting app1, it should launch app2
and do some processing, then app2 starts app1 with startActivity().

my new manifest.xml for app1 looks like this - changed the main
activity. (pointing to activity in app2)

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.mytest.android.hellotest"  android:versionCode="1"
android:versionName="1.0.0">
    <application android:icon="@drawable/icon" android:label="@string/
app_name">
        <activity android:name="com.mytest.android.testapp.TestApp"
android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
</manifest>

With the above, I got "Class com.mytest.android.testapp.TestApp
doesn't exist". I tried using sharedUsedId. Same error.

I would like to know if it's possible to launch another app's main
activity by changing manifest.xml?

Thanks,
sumd

--~--~---------~--~----~------------~-------~--~----~

2. How to copy file from apk raw folder

I have an app that plays sound files and I want to be able to allow
users to save those sound files as ringtones.  Is this possible?  The
sound files are in my apk's raw folder.  How can I allow a user to
copy a particular sound file from my app, so they can use it as a
ringtone?

Thanks

--~--~---------~--~----~------------~-------~--~----~

3. Installing the Eclipse Ganemede Plugin (ADT) for Android

4. MediaScanner connect

5. 1.5 compiled image?

6. ADB refuses to work

7. Observation and comments on Android and "regularly" scheduled events