video within webkit ?

All your problems with Audio, Video and Images.

video within webkit ?

Postby darolla » Thu Jun 24, 2010 9:22 pm

hello,

I made my own mobile webpage with a link to a video.

Using the Android default browser a touch onto this video link starts the video player (don't know if it's a plugin or an activity).

I build my own webkit showing the mobile webpage.

But touching the video link doesn't do anything.

So I googled and found setPluginsEnabled(true) which wasn't helpfull at all.

Right know I am using my own intent filter (manifest) and my own overridden WebViewClient.

The user is asked to choose between different activities in order to play the video. E.g. the default browser is suggested :(

But the behaviour right now destroys the illusion of a webapp.

Do you know how to get the same behaviour out of my webapp as the default browser does (a touch into the video link just plays the video)?

Here comes some code:

Code: Select all
    <application android:icon="@drawable/icon" android:label="@string/app_name">

        <activity android:name=".MyWebkitActivity" android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <intent-filter>
                <action android:name="android.intent.action.VIEW"></action>
                <category android:name="android.intent.category.DEFAULT"></category>
                <category android:name="android.intent.category.BROWSABLE"></category>
                <data android:host="streamserver" android:scheme="http"></data>
            </intent-filter>

        </activity>
    </application>


    private class MyWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
//          view.loadUrl(url);
//          return true;
            if (url.startsWith("http://streamserver")){
                startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
                return true;
            } else {
                return false;
            }
        }
    }   


        webview = (WebView) findViewById(R.id.webview);
        webview.setWebViewClient(new MyDroidWebViewClient());
        webview.getSettings().setJavaScriptEnabled(true);
        webview.getSettings().setPluginsEnabled(true);
        webview.loadUrl("http://meinemobilewebseitemitdemvideolink.de");


Best regards,
Marco Schmitz
User avatar
darolla
Master Developer
Master Developer
 
Posts: 273
Joined: Thu Sep 25, 2008 5:16 pm
Location: Dortmund, Germany

Top

Re: video within webkit ?

Postby androidandme » Fri Jul 09, 2010 7:17 am

Hi Marco,

Even I want to play Media / video using Android webkit browser from server.. can you pls. guide me on how to achieve this?
androidandme
Freshman
Freshman
 
Posts: 2
Joined: Thu Jul 08, 2010 11:30 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 10 guests