A
aapp
Neues Mitglied
- 0
bissher war meine intensive suche erfolglos :-(
ich will ein video das lokal liegt per Link im webview, starten.
-> es muss vom webview aus sein, also per link (egal wie), so dass ich nur die links anpassen auf ein neues video.
-> es darf wegen dem traffic nicht auf dem server liegen, nur lokal
-> videoformat ist egal hauptsache da bewegt sich was.
mir ist auch egal ob nun dort ein mediaplayer, brwoser oder sonst was geöffnet wird. also per klick auf link = video.
hier mein aktueller code, mit dem ich sehr weit schon komme:
der entsprechende HTML-Code:
natürlich liegen index.html + vid.m4v im gleichen verzeichnis.
Es wird tatsächlich ein player geöffnet und dieser meldet dann
"sorry, this video cannot be played" (in der emu) und "unbekannter dateityp" auf dem handy..... natürlich kann das handy das video abspielen. habe es mit dem gerät aufgenommen und wenn ich es anklicke auf dem handy spielt es ab.. mp4/m4v, wmv, usw.
kann mir jemand weiterhelfen? das problem ärgert mich schon einige tage.
permissions = nur "Internet" gesetzt, fehlt ggf etwas?
[/LEFT]
ich will ein video das lokal liegt per Link im webview, starten.
-> es muss vom webview aus sein, also per link (egal wie), so dass ich nur die links anpassen auf ein neues video.
-> es darf wegen dem traffic nicht auf dem server liegen, nur lokal
-> videoformat ist egal hauptsache da bewegt sich was.
mir ist auch egal ob nun dort ein mediaplayer, brwoser oder sonst was geöffnet wird. also per klick auf link = video.
hier mein aktueller code, mit dem ich sehr weit schon komme:
Code:
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public
[/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]class[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] dasDing [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]extends[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Activity {[/SIZE]
[LEFT][SIZE=2][COLOR=#3f5fbf][SIZE=2][COLOR=#3f5fbf]/** Called when the activity is first created. */[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f5fbf]
[/COLOR][/SIZE][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#646464]
[/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] onCreate(Bundle savedInstanceState) {[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]super[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2].onCreate(savedInstanceState);[/SIZE]
[SIZE=2]setContentView(R.layout.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]main[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE][/LEFT]
[LEFT][SIZE=2]WebView webview = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] WebView([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]this[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]); [/SIZE][/LEFT]
[LEFT][SIZE=2]WebSettings webSettings = webview.getSettings(); [/SIZE]
[SIZE=2]webSettings.setJavaScriptEnabled([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]true[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]); [/SIZE]
[SIZE=2]webview.getSettings().setJavaScriptCanOpenWindowsAutomatically([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]true[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]);[/SIZE]
[SIZE=2]webSettings.setPluginsEnabled([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]true[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]); [/SIZE]
[SIZE=2]webSettings.setLoadsImagesAutomatically([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]true[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]); [/SIZE]
[SIZE=2]webSettings.setSupportZoom([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]false[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]); [/SIZE][/LEFT]
[LEFT][SIZE=2]webview.getSettings().setAllowFileAccess([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]true[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]);[/SIZE]
[SIZE=2]webview.setWebViewClient([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] ArticleWebViewClient()); [/SIZE][/LEFT]
[LEFT][SIZE=2]webview.loadUrl([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"file:///android_asset/index.htm"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]); [/SIZE]
[SIZE=2]setContentView(webview); [/SIZE]
[SIZE=2]webview.setInitialScale(100);[/SIZE][/LEFT]
[LEFT][SIZE=2]}[/SIZE][/LEFT]
[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/LEFT]
[/LEFT]
[/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]class[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] ArticleWebViewClient [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]extends[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] WebViewClient { [/SIZE]
[LEFT][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/COLOR][/SIZE][/COLOR][/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]boolean[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] shouldOverrideUrlLoading(WebView view, String url) { [/SIZE][/LEFT]
[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] (url.endsWith([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]".m4v"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2])) { [/SIZE]
[SIZE=2]Intent intent = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Intent(Intent.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]ACTION_VIEW[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]); [/SIZE]
[SIZE=2]intent.setDataAndType(Uri.[I]parse[/I](url), [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"video/*"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]); [/SIZE]
[SIZE=2]view.getContext().startActivity(intent); [/SIZE][/LEFT]
[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]true[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]; [/SIZE][/LEFT]
[LEFT][SIZE=2]} [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]else[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] { [/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]false[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]; [/SIZE]
[SIZE=2]} [/SIZE]
[SIZE=2]} [/SIZE][/LEFT]
[LEFT][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/COLOR][/SIZE][/COLOR][/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] onPageFinished(WebView view, String url) { [/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]super[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2].onPageFinished(view, url); [/SIZE][/LEFT]
[LEFT][SIZE=2]} [/SIZE]
[SIZE=2]} [/SIZE][/LEFT]
der entsprechende HTML-Code:
Code:
<a href="vid.m4v">video</a><br>
<a href="file:///android_asset/vid.m4v">video_assets</a><br>
natürlich liegen index.html + vid.m4v im gleichen verzeichnis.
Es wird tatsächlich ein player geöffnet und dieser meldet dann
"sorry, this video cannot be played" (in der emu) und "unbekannter dateityp" auf dem handy..... natürlich kann das handy das video abspielen. habe es mit dem gerät aufgenommen und wenn ich es anklicke auf dem handy spielt es ab.. mp4/m4v, wmv, usw.
kann mir jemand weiterhelfen? das problem ärgert mich schon einige tage.
permissions = nur "Internet" gesetzt, fehlt ggf etwas?
[/LEFT]