在Android WebView中从链接播放MP4或MP3(Playing an MP4 or MP3 from a Link within an Android WebView)
我已经搜索得很远,似乎无法找到确切的答案或甚至关闭。
我有一个打开网页的WebView(JQuery Mobile),一切都很好。
在该页面中,有静态链接到mp3和mp4文件。 这个想法是,点击时 - 设备将打开默认的声音或电影应用程序来播放。 这在没有问题的情况下使用Android浏览器时有效。
当我打开WebView内部,并点击相同的链接 - 没有任何反应。 没有东西打开或播放。
我将getSettings设置为尽可能广泛。
**web.getSettings().setJavaScriptEnabled(true);
web.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
web.getSettings().setPluginsEnabled(true);
web.getSettings().setSupportMultipleWindows(true);
web.getSettings().setSupportZoom(true);
web.getSettings().setBuiltInZoomControls(true);
web.getSettings().setAllowFileAccess(true);
web.setVerticalScrollBarEnabled(false);
web.setHorizontalScrollBarEnabled(false);**
我还会注意到,我相信“shouldOverrideUrlLoading”只适用于在WebView中加载的初始URL。 这是该WebView内的链接 - 所以似乎不起作用。
我曾尝试过。
关于如何使用户能够点击WebView中的链接并像浏览器一样打开相关应用程序的任何想法?
非常感激!
/ R
I have searched far and wide and can't seem to find the exact answer or even close.
I have a WebView that opens a webpage (JQuery Mobile) and all is well.
Within that page there are static links to both mp3 and mp4 files. The idea is that when clicked - the device will open the default sound or movie app to play each. This works when using the A