Android-通过url链接启动mp3

Android-通过url链接启动mp3,android,stream,webview,android-intent,mp3,Android,Stream,Webview,Android Intent,Mp3,我目前有一个网络视图,当你按下mp3链接时,mp3将开始播放。我们最近更改了所有链接,它们现在是https而不是http。我从日志cat收到的错误如下: 08-09 17:26:59.060: ERROR/AndroidRuntime(5574): FATAL EXCEPTION: main 08-09 17:26:59.060: ERROR/AndroidRuntime(5574): android.content.ActivityNotFoundException: No Activity

我目前有一个网络视图,当你按下mp3链接时,mp3将开始播放。我们最近更改了所有链接,它们现在是https而不是http。我从日志cat收到的错误如下:

08-09 17:26:59.060: ERROR/AndroidRuntime(5574): FATAL EXCEPTION: main
08-09 17:26:59.060: ERROR/AndroidRuntime(5574): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=https://s3.amazonaws.com/StopDropRave/Week+of+August+8/Flawless+ft.+Army+of+Karmen+-+L.I.E.+%28Love+Automatic+Dubstep+Remix%29.mp3 typ=audio/* }
08-09 17:26:59.060: ERROR/AndroidRuntime(5574):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1409)
08-09 17:26:59.060: ERROR/AndroidRuntime(5574):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
08-09 17:26:59.060: ERROR/AndroidRuntime(5574):     at android.app.Activity.startActivityFromChild(Activity.java:3067)
08-09 17:26:59.060: ERROR/AndroidRuntime(5574):     at android.app.Activity.startActivityForResult(Activity.java:2847)
08-09 17:26:59.060: ERROR/AndroidRuntime(5574):     at android.app.Activity.startActivity(Activity.java:2933)
08-09 17:26:59.060: ERROR/AndroidRuntime(5574):     at ravebox.dev.sdr.BlogActivity$HelloWebViewClient$1.onClick(BlogActivity.java:158)
08-09 17:26:59.060: ERROR/AndroidRuntime(5574):     at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:159)
08-09 17:26:59.060: ERROR/AndroidRuntime(5574):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-09 17:26:59.060: ERROR/AndroidRuntime(5574):     at android.os.Looper.loop(Looper.java:123)
08-09 17:26:59.060: ERROR/AndroidRuntime(5574):     at android.app.ActivityThread.main(ActivityThread.java:3835)
08-09 17:26:59.060: ERROR/AndroidRuntime(5574):     at java.lang.reflect.Method.invokeNative(Native Method)
08-09 17:26:59.060: ERROR/AndroidRuntime(5574):     at java.lang.reflect.Method.invoke(Method.java:507)
08-09 17:26:59.060: ERROR/AndroidRuntime(5574):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
08-09 17:26:59.060: ERROR/AndroidRuntime(5574):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
08-09 17:26:59.060: ERROR/AndroidRuntime(5574):     at dalvik.system.NativeStart.main(Native Method)
我不知道是不是因为https。不知道。有什么想法吗?谢谢

这是我对这一特定活动的清单部分:

<activity android:name=".BlogActivity"
                  android:label="@string/app_name"
                  android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
塞吉奥拉, 看起来您有“BlogActivity”,您正试图从中播放任何音频文件。 默认情况下,Android音乐播放器应用程序将用于播放链接中的数据。 音乐播放器应用程序中的流媒体播放器活动将数据方案设置为仅http,因此不会使用https方案播放新链接中的内容

已经有了这样的查询,这里是链接

这就是为什么下载效果很好,但播放效果不好的原因。
因此,我建议您在播放之前将文件下载到设备上的一个临时位置。

在将链接更改为https之前,是否对播放进行了测试?@Deepak:是的,以前一切正常。没有任何问题。您能检查清单文件的意图过滤器吗?看起来筛选器与您要播放的数据类型和类型不匹配?检查“http://”是否已在筛选器的某些部分硬编码。我添加了上面清单的该部分以及处理侦听部分的代码。下载部分工作正常,但另一部分工作不太正常。我不知道这是否是由于https,我需要某种证书,但它没有要求。
private class HelloWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(final WebView view,
                final String url) {
            view.loadUrl(url);
            view.getSettings().getAllowFileAccess();
            view.getSettings().setJavaScriptEnabled(true);
            view.getCertificate();
            // load the dropbox files so people can listen to the track
            if (url.startsWith("https://") && url.endsWith(".mp3")) {
                view.getCertificate();
                progressWebView.dismiss();
                progressWebView.cancel();
                /*blogDialog.setButton("Listen",
                        new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog,
                                    int which) {
                                Intent intent = new Intent(Intent.ACTION_VIEW);
                                intent.setDataAndType(Uri.parse(url), "audio/*");
                                view.getContext().startActivity(intent);

                            }
                        });*/
                blogDialog.setButton2("Download",
                        new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog,
                                    int which) {
                                sdrUrl = url.toString();
                                new DownloadFile().execute();

                            }

                        });
                blogDialog.show();

            } else {
                return super.shouldOverrideUrlLoading(view, url);
            }
            return true;
        }
    }