5

I have this problem: i'm testing this script in a sample android 2.2 (API 8) project.
When i run my app on the device or emulator, the WebView displays the video but if I tap to play, the app doesn't play it: the video become all black.
If i put my script in a .html file in a server and I open it from the native browser, in the SAME smartphone, the video is loaded and playable!!!
I know that the script uses a jwEmbedder wich should dynamically create an html5 tag "video" .

I have made many attempts to solve the problem, and now I don't know what to do. I only think that my WebView doesn't have permissions or ability to launch the native video app when i play the video...

SenapeLuz.java (main activity)

public class SenapeLuz extends Activity {
    private WebView mWebView;
    final Activity activity = this;

    // private Button b;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_senape_luz);
        mWebView = (WebView) findViewById(R.id.webView1);
        mWebView.getSettings().setPluginsEnabled(true);
        mWebView.getSettings().setPluginState(PluginState.ON);
        mWebView.getSettings().setSupportMultipleWindows(true);
        mWebView.getSettings().setJavaScriptEnabled(true);
        mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
        mWebView.getSettings().setDomStorageEnabled(true);
        mWebView.setWebChromeClient(new WebChromeClient());

        mWebView.loadUrl("file:///android_asset/Senape.html");
    }
}

Senape.html (the script)

<script type="text/javascript" src="http://platform.senape.tv/widget/video.action?v=1.0&key=ZD9L6ZHH5B60&rid=I95EE9HL0LNP"></script>

Manifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.prove.senape"
        android:versionCode="1"
        android:versionName="1.0" >

        <uses-permission android:name="android.permission.INTERNET" />
        <uses-sdk
            android:minSdkVersion="8"
            android:targetSdkVersion="15" />

        <application
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/AppTheme" >
            <activity
                android:name=".SenapeLuz"
                android:label="@string/title_activity_senape_luz" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />

                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>

    </manifest>

Somebody can help me?

Luca Corradi
  • 2,031
  • 1
  • 16
  • 17

1 Answers1

3

I have a few questions for you about why you are using the webview to play the video. I found this tutorial on embedding a specific video into a webview which also gives you some controls to play it.

Is it necessary for you to download/play the video from location? Why not include the video within the app itself? There are many tutorials but one I've used quite a lot is this one

The other question is: What else is contained within the html file? Is your desire to use an external html file in your app about additional information and formatting or just looking for a way to play a video?

The mediacontroller device has many implementations that work from external video files if memory is an issue. An advantage in your current example is you are only looking to stream a single specific video.

Hope that helps.

Community
  • 1
  • 1
Music Monkey
  • 340
  • 4
  • 15