danylovolokh/VideoPlayerManager

Play video from URL on clicking play button In RecyclerView

k2evil opened this issue · 1 comments

I'm trying to use your library for handling the playing one video at once. But there's a difference which I need to start the video whenever user clicked on play button.
I created an instance of VideoPlayerManager in my fragment and pass it to the Adapter in constructor.

In fragment :

private VideoPlayerManager<MetaData> mVideoPlayerManager = new SingleVideoPlayerManager(new PlayerItemChangeListener() {
    @Override
    public void onPlayerItemChanged(MetaData metaData) {

    }
});

public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
     ...
   adapter = new FeedsAdapter(getContext(), mVideoPlayerManager);
     ...
}

In adapter:

public FeedsAdapter(Context context, VideoPlayerManager videoPlayerManager) {
        super(context);
        mVideoPlayerManager = videoPlayerManager;
}

Now whenever user clicks on play button, I call this inside the adapter itself:

public void onBindItemViewHolder(FeedViewHolder holder, int position) {
        ...
        holder.imageviewPlayVideo.setOnClickListener(v -> {
                mVideoPlayerManager.playNewVideo(null, holder.videoview, url)
        }
        ...
}

The problem is that the VideoPlayerView is completely blank and only the sound of the video is playing. What am I missing?

@danylovolokh You are not supporting this library anymore?