douzhanglu4591 2016-06-29 18:04
浏览 149

在android WebView中播放存储在服务器中的视频

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.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 求差集那个函数有问题,有无佬可以解决
    • ¥15 MATLAB动图问题
    • ¥15 【提问】基于Invest的水源涵养
    • ¥20 微信网友居然可以通过vx号找到我绑的手机号
    • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
    • ¥15 解riccati方程组
    • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
    • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
    • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
    • ¥50 树莓派安卓APK系统签名