-1

I got a problem related to playing videos based on Url i get. I made 2 cases, but each one has its problem.

1) using android VideoView

 videoPlayer.setVideoURI(Uri.parse(videoUrl));
        videoPlayer.setMediaController(new MediaController(this));
        videoPlayer.requestFocus();
        videoPlayer.start();

The problem is that it doesn't open such types of video url https://www.facebook.com/zloishkolnik/videos/462625797256094/

https://www.youtube.com/watch?v=YVkUvmDQ3HY

2) using android WebView

  videoPlayer.setWebViewClient(new WebViewClient());
        videoPlayer.getSettings().setJavaScriptEnabled(true);
        videoPlayer.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
        videoPlayer.getSettings().setPluginState(WebSettings.PluginState.ON);
        videoPlayer.setWebChromeClient(new WebChromeClient());
        videoPlayer.loadUrl(videoUrl);

Webview opens the links above, but doesnt open such type of links http://www.db.cartosnet.com/videos/EU5beThfNI.mp4

Am i doing something wrong or there is any library that reads any video url given?

moodle
  • 149
  • 1
  • 1
  • 10
  • 1
    to run youtube videos you need you tube api – sud Dec 02 '15 at 08:46
  • this because facebook and youtube requires authentication to play there videos – sud Dec 02 '15 at 08:47
  • see this tutorial [http://www.androidhive.info/2014/12/how-to-play-youtube-video-in-android-app/](http://www.androidhive.info/2014/12/how-to-play-youtube-video-in-android-app/) – sud Dec 02 '15 at 08:49

1 Answers1

0

To play videos through your way (setting a url to Videoview), your endpoint must be the video as itself. Example of a valid endpoint: https://ia600404.us.archive.org/1/items/popeye_patriotic_popeye/popeye_patriotic_popeye_512kb.mp4

If you want to play videos, in your case, embedded videos, you should use a API (like Youtube, Facebook...)

Billyjoker
  • 729
  • 1
  • 10
  • 31