'playing video from url channel in android
I want to play live tv channel in android app how we use live tv channel i use exoplayer but dosent work. Here is my code
try {
String videoURL = "https://www.samaa.tv/live/";
BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
TrackSelector trackSelector = new DefaultTrackSelector(new AdaptiveTrackSelection.Factory(bandwidthMeter));
exoPlayer = ExoPlayerFactory.newSimpleInstance(this, trackSelector);
Uri videouri = Uri.parse(videoURL);
DefaultHttpDataSourceFactory dataSourceFactory = new DefaultHttpDataSourceFactory("exoplayer_video");
ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
MediaSource mediaSource = new ExtractorMediaSource(videouri, dataSourceFactory, extractorsFactory, null, null);
exoPlayerView.setPlayer(exoPlayer);
exoPlayer.prepare(mediaSource);
exoPlayer.setPlayWhenReady(true);
} catch (Exception e) {
Log.e("TAG", "Error : " + e.toString());
}
Solution 1:[1]
use official youtube api instead of exo player or other library.
add Webview to your app and use this GET https://www.googleapis.com/youtube/v3/videos to extract the videos or attach direct link to that api
heres the forum to youtube api and documentation https://developers.google.com/youtube/v3/docs/videos/list
Solution 2:[2]
Try these links below in exoplayer
https://youtu.be/IH0Bmc2jRiohttps://www.youtube.com/watch?v=IH0Bmc2jRio
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | paradox codee |
| Solution 2 | Neptotech -vishnu |
