javascript - Playing a video stored in server in android WebView

502

This is the thing.

I have designed a web page and stored it in an apache server. The web page uses php to load an html with directories of images, audio and video files. Then, when selecting a directory, a php section also displays thumbnails form files contained in selected directory. The thumbnails are displayed in an to load everything in the same page.

I load the page in a web browser and works fine. After displaying the thumbnails, I can select any of them, it doesn matter if is an image and audio or a video. I can see normal size of image, I can listen the audio and I can see the video playing in the same iframe (which is what I want), depending on what I have selected.

On Android app:

Then, i have created an android app using only WebView to load the page in the app. Page is loaded perfectly. I can select an image and see the original size of image in the same iframe. But, audio files and video files are not played on the iframe, not even played in a different page. I want them to be played on the same iframe. Everything is loaded in the WebView only.

I don know if this could be done correctly like this.

WebView code is here:

    WebView myWebView = (WebView) findViewById(R.id.webView); 
    WebSettings webSettings = myWebView.getSettings(); 
    webSettings.setBuiltInZoomControls(true);
    webSettings.setJavaScriptEnabled(true);               
    webSettings.setPluginState(WebSettings.PluginState.ON);

    // Load page in apache server.
    myWebView.loadUrl(url:"defined previously");

If anyone could be helpful that would be much appreciated. Thanks.

People are also looking for solutions to the problem: regex - PHP preg_replace replace between slash

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.