you should use vitamio library for this issue vitamio library from here http://www.vitamio.org/en/docs/Basic/2013/0509/4.html
android live streaming for video is not working
-
31-08-2022 - |
Question
hi i want to stream live channels using android app i have done lots of search but i couldn't find any solution
i am playing live stream using this code but it is not playing and giving error "sorry this video can not be played".
my code is
String link="http://cdn.livestream.com/grid/LSPlayer.swf?channel=ontveg&clip=&time=&showMoreVideos=false&hideInfo=true&autoPlay=true&lschannel=true&browseMode=false&textLines=2&hideChannelBranding=true&mode=false&allowchat=false&t=99398";
VideoView view1 = (VideoView) findViewById(R.id.video_view);
getWindow().setFormat(PixelFormat.TRANSLUCENT);
MediaController mc = new MediaController(this);
mc.setMediaPlayer(view1);
view1.setMediaController(mc);
view1.setVideoURI(Uri.parse(link));
view1.requestFocus();
view1.start();
Solution
OTHER TIPS
You just have to:
- Call prepareAsync() on the VideoView object.
- setOnPreparedLsitener() to your VideoView.
- In onPrepared() callback, requestFocus and start() the VideoView.
Good Luck
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow