2014-09-29 26 views
12

Web sayfalarında html5 video etiketlerini kullanarak video dosyalarının gönderimi sağlandı.Android içinde video göremiyoruz Web View

Dosya sistemimdeki dosyama hizmet veren bir katıştırılmış web sunucum (NanoHTTPD) var. Diğer her şey çalışıyor, ancak HTML5 videosunun oynatımını tıkladığımda. Aşağıdaki hata veriyor ve video medya oynatıcı içeriği şemasının dosyaları yüklemeye çalışır İçerik resolvere gider

09-29 20:38:36.620: D/HTML5VideoInline(11532): HTML5VideoInline created 
09-29 20:38:36.625: V/MediaPlayer(11532): setVideoSurfaceTexture 
09-29 20:38:36.625: V/MediaPlayer-JNI(11532): reset 
09-29 20:38:36.625: V/MediaPlayer(11532): reset 
09-29 20:38:36.625: I/MediaPlayer(11532): path is null 
09-29 20:38:36.640: D/MediaPlayer(11532): setDataSource IOException happend : 
09-29 20:38:36.640: D/MediaPlayer(11532): java.io.FileNotFoundException: No content provider: http://10.207.114.115:8765/SLC/Book3_html/Book3/book/BO/demo.mp4 
09-29 20:38:36.640: D/MediaPlayer(11532): at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:713) 
09-29 20:38:36.640: D/MediaPlayer(11532): at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:617) 
09-29 20:38:36.640: D/MediaPlayer(11532): at android.media.MediaPlayer.setDataSource(MediaPlayer.java:954) 
09-29 20:38:36.640: D/MediaPlayer(11532): at android.webkit.HTML5VideoView.prepareDataCommon(HTML5VideoView.java:326) 
09-29 20:38:36.640: D/MediaPlayer(11532): at android.webkit.HTML5VideoView.prepareDataAndDisplayMode(HTML5VideoView.java:363) 
09-29 20:38:36.640: D/MediaPlayer(11532): at android.webkit.HTML5VideoInline.prepareDataAndDisplayMode(HTML5VideoInline.java:72) 
09-29 20:38:36.640: D/MediaPlayer(11532): at android.webkit.HTML5VideoViewProxy$VideoPlayer.play(HTML5VideoViewProxy.java:289) 
09-29 20:38:36.640: D/MediaPlayer(11532): at android.webkit.HTML5VideoViewProxy.handleMessage(HTML5VideoViewProxy.java:465) 
09-29 20:38:36.640: D/MediaPlayer(11532): at android.os.Handler.dispatchMessage(Handler.java:99) 
09-29 20:38:36.640: D/MediaPlayer(11532): at android.os.Looper.loop(Looper.java:137) 
09-29 20:38:36.640: D/MediaPlayer(11532): at android.app.ActivityThread.main(ActivityThread.java:5306) 
09-29 20:38:36.640: D/MediaPlayer(11532): at java.lang.reflect.Method.invokeNative(Native Method) 
09-29 20:38:36.640: D/MediaPlayer(11532): at java.lang.reflect.Method.invoke(Method.java:511) 
09-29 20:38:36.640: D/MediaPlayer(11532): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102) 
09-29 20:38:36.640: D/MediaPlayer(11532): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) 
09-29 20:38:36.640: D/MediaPlayer(11532): at dalvik.system.NativeStart.main(Native Method) 
09-29 20:38:36.640: D/MediaPlayer(11532): Couldn't open file on client side, trying server side 

oynatmıyor. Ümitlerim http şeması.

Web görünümüm sade bir tanesidir.

WebSettings webViewSettings = webView.getSettings(); 
    webViewSettings.setJavaScriptEnabled(true); 
    //webViewSettings.setJavaScriptCanOpenWindowsAutomatically(false); 
    //webViewSettings.setSupportMultipleWindows(true); 
    webViewSettings.setPluginState(PluginState.ON); 
    //webViewSettings.setMediaPlaybackRequiresUserGesture(false); 
    webViewSettings.setAllowFileAccess(true); 
    webView.setSoundEffectsEnabled(true); 
    //webViewSettings.setSupportZoom(true); 
    //WebView.setWebContentsDebuggingEnabled(true); 

    webView.setWebViewClient(new CustomWebViewClient()); 
    webView.setWebChromeClient(mWebChromeClient); 

şerefe, Saurav

+1

https: // stackoverflow öğesini çağırıyorsunuz. com/a/16179544/6490462 – Ibrahim

cevap

0

Sen loadDataWithBaseURL kullanmak gerekir.

bu bakınız: https://stackoverflow.com/a/24592012/850347

bunu YAPMAYIN:

mContentWebView.loadDataWithBaseURL(null, webViewContentString, 
     "text/html", "UTF-8", null); 

YERİNE BU YAPIN:

//veryVeryVery important for playing the videos! 
mContentWebView.loadDataWithBaseURL(theBaseUrl, webViewConentString, 
     "text/html", "UTF-8", null); 
0

sorunu ayarlama setDataSource() var gibi görünüyor, emin olun

setDataSource(String path)