danylovolokh / VideoPlayerManager

This is a project designed to help controlling Android MediaPlayer class. It makes it easier to use MediaPlayer ListView and RecyclerView. Also it tracks the most visible item in scrolling list. When new item in the list become the most visible, this library gives an API to track it.
3.15k stars 747 forks source link

How to pass video url string path to the VideoPlayerView #30

Open Cruzbenhur opened 8 years ago

Cruzbenhur commented 8 years ago

I want to pass the video url to the videoplayerview dont know where to pass it help me out... //for passing asset files mList.add(ItemFactory.createItemFromAsset("video_sample_1.mp4", R.drawable.video_sample_1_pic, getActivity(), mVideoPlayerManager)); //How to add list of video urls in the mList

RockyLin commented 8 years ago

Eventually, it's AssetVideoItem's method that handles the video from url public void playNewVideo(MetaData currentItemMetaData, VideoPlayerView player, VideoPlayerManager videoPlayerManager){ videoPlayerManager.playNewVideo(currentItemMetaData, player, videoUrl); }

ShahbazA commented 8 years ago

Made this method for playing from url in Recylerview:

public static BaseVideoItem playFromUrl(String assetName, String mUrl, Activity activity, VideoPlayerManager videoPlayerManager, int imageResource) throws IOException { return new AssetVideoItem(assetName, videoPlayerManager, Picasso.with(activity), mUrl, imageResource); }

gives exception and wont play video:

E/AndroidRuntime: FATAL EXCEPTION: pool-1-thread-1 Process: com.testingvideoplayer, PID: 17436 java.lang.RuntimeException: java.io.IOException: setDataSource failed.: status=0x80000000 at com.volokh.danylo.video_player_manager.ui.VideoPlayerView.setDataSource(VideoPlayerView.java:263) at com.volokh.danylo.video_player_manager.player_messages.SetUrlDataSourceMessage.performAction(SetUrlDataSourceMessage.java:24) at com.volokh.danylo.video_player_manager.player_messages.PlayerMessage.runMessage(PlayerMessage.java:40) at com.volokh.danylo.video_player_manager.MessagesHandlerThread$1.run(MessagesHandlerThread.java:61) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818) Caused by: java.io.IOException: setDataSource failed.: status=0x80000000 at android.media.MediaPlayer.nativeSetDataSource(Native Method) at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1071) at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1032) at com.volokh.danylo.video_player_manager.ui.MediaPlayerWrapper.setDataSource(MediaPlayerWrapper.java:164) at com.volokh.danylo.video_player_manager.ui.VideoPlayerView.setDataSource(VideoPlayerView.java:259) at com.volokh.danylo.video_player_manager.player_messages.SetUrlDataSourceMessage.performAction(SetUrlDataSourceMessage.java:24)  at com.volokh.danylo.video_player_manager.player_messages.PlayerMessage.runMessage(PlayerMessage.java:40)  at com.volokh.danylo.video_player_manager.MessagesHandlerThread$1.run(MessagesHandlerThread.java:61)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)  at java.lang.Thread.run(Thread.java:818) 

Bhavesh-Moradiya commented 6 years ago

Hi, I am also having problem in that how to pass string to list the video.

Example: /storage/emulated/0/Camera/video_20181005_120633.mp4" /storage/emulated/0/Camera/video_20181005_120621.mp4" /storage/emulated/0/Camera/video_20181005_120609.mp4"

I have this 3 string that I want to list in my project but library seems to complex for me, Please help me how can I pass these string in adapter @danylovolokh @Cruzbenhur @RockyLin

Thank You