URL encoding not supported

I have a file on the Internet. I am trying to reproduce it with media player using live streaming. But the media player gives error (-1,1004)  I think that my media player does not get the correct URL, because it contains Arabic characters, so I tried to encode it using Html.encode or the UrlEncoder class , still getting the same error .

So finally, I loaded this url in webview and finished loading the page. I passed the URL of the webpage to the media player.

    WebView webView = new WebView(SongActivity.this);
        webView.setSoundEffectsEnabled(false);
        webView.loadUrl("MY URL");
        webView.setWebViewClient(new WebViewClient() {
            public void onPageFinished(WebView view, String url) {

                try {

                playerService.startPlay(url );// this passes url to media player and url will be played using media player

                } catch (IllegalArgumentException e) {
                    e.printStackTrace();
                } catch (IllegalStateException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                }

            };

            public void onPageStarted(WebView view, String url,
                    android.graphics.Bitmap favicon) {
                System.out.println("Decoding url:" + strURl);
            };
        });

It works great, also knows how to play a song, but it's not standard. For a normal URL (which does not have Arabic characters), the media player code works fine.

Can you provide me some standard solution?

+5
1

(-1,1004) , HTTP 403 Forbidden . Uri.encode(String).toString() mediaPlayer.setDataSource(String url)?

fooobar.com/questions/15027/...:

URLEncoder! , HTML-, URL.

+1

All Articles