danylovolokh/VideoPlayerManager

Nothing gets displayed in the VideoPlayerView

Closed this issue · 4 comments

It's awesome that I got to found this alternative instead of the screwing VideoView in my app.

When I implemented this VideoPlayerManager, the video isn't getting played. I also noticed that none of the Log Statements have been printed on the console. Can you please guide me?

Code for my Custom Message Adapter:

public class MessageAdapter extends ArrayAdapter<Message> {

    ...

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

        }
    });

    private int mScrollState = AbsListView.OnScrollListener.SCROLL_STATE_IDLE;

    @Override
    @NonNull
    public View getView(int position, View convertView, ViewGroup parent) {
        ...
        viewHolder.videoPlayerView = (VideoPlayerView) convertView.findViewById(R.id.video_player_1);
        viewHolder.videoCover = (ImageView) convertView.findViewById(R.id.video_cover_1);

        final boolean isPhoto = message.getPhotoUrl() != null;
        boolean isVideo = message.getVideoUrl() != null;

        if (isPhoto) {
            // Photo Present
            ...
        } else if (isVideo) {
            // Video Present
            viewHolder.messageTextView.setVisibility(View.GONE);
            viewHolder.photoImageView.setVisibility(View.GONE);
            viewHolder.timeStamp.setVisibility(View.VISIBLE);
            viewHolder.videoPlayerView.setVisibility(View.VISIBLE);

            viewHolder.videoPlayerView.addMediaPlayerListener(new SimpleMainThreadMediaPlayerListener() {
                @Override
                public void onVideoPreparedMainThread() {
                    // We hide the cover when video is prepared. Playback is about to start
                    Log.d(TAG, "onVideoPreparedMainThread()");
                    viewHolder.videoCover.setVisibility(View.INVISIBLE);
                    //viewHolder.videoPlayerView.start();
                }

                @Override
                public void onVideoStoppedMainThread() {
                    // We show the cover when video is stopped
                    Log.d(TAG, "onVideoStoppedMainThread()");
                    viewHolder.videoCover.setVisibility(View.VISIBLE);
                }

                @Override
                public void onVideoCompletionMainThread() {
                    // We show the cover when video is completed
                    Log.d(TAG, "onVideoCompletionMainThread()");
                    viewHolder.videoCover.setVisibility(View.VISIBLE);
                }
            });

            viewHolder.videoCover.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.d(TAG, "VideoViewPlayer Clicked $ $ ");
                    mVideoPlayerManager.playNewVideo(null, viewHolder.videoPlayerView, message.getLocalVideoPath());
                }
            });

        } else {
            // Photo absent or video absent
            ...
        }

        ...
        return convertView;
    }
}

This is the trace in the LogCat:

06-19 10:55:51.945 V: 1 >> onAttachedToWindow false
06-19 10:55:51.945 V: >> startThread
06-19 10:55:51.946 V: onLooperPrepared Thread[VideoPlayerView@13162081,5,main]
06-19 10:55:51.946 V: << startThread
06-19 10:55:51.946 V: 1 << onAttachedToWindow
06-19 10:55:51.946 V: 1 >> onVisibilityChanged GONE, isInEditMode false
06-19 10:55:51.946 V: 1 << onVisibilityChanged
06-19 10:55:52.013 V: 1 >> onDetachedFromWindow, isInEditMode false
06-19 10:55:52.013 V: 1 << onDetachedFromWindow
06-19 10:55:52.013 V: postQuit, run
06-19 10:55:52.062 V: 1 >> onAttachedToWindow false
06-19 10:55:52.062 V: >> startThread
06-19 10:55:52.063 V: onLooperPrepared Thread[VideoPlayerView@259862114,5,main]
06-19 10:55:52.063 V: << startThread
06-19 10:55:52.063 V: 1 << onAttachedToWindow
06-19 10:55:52.064 V: 1 >> onVisibilityChanged VISIBLE, isInEditMode false
06-19 10:55:52.064 V: 1 << onVisibilityChanged
06-19 10:55:52.068 V: 1 onSurfaceTextureAvailable, width 765, height 510, this VideoPlayerView@259862114
06-19 10:55:52.068 V: 1 >> notifyTextureAvailable
06-19 10:55:52.068 V: post, successfullyAddedToQueue true
06-19 10:55:52.068 V: 1 << notifyTextureAvailable
06-19 10:55:52.069 V: 20939 >> run notifyTextureAvailable
06-19 10:55:52.069 V: 20939 mMediaPlayer null, cannot set surface texture
06-19 10:55:52.069 V: 20939 isVideoSizeAvailable false
06-19 10:55:52.069 V: 20939 isReadyForPlayback false
06-19 10:55:52.069 V: 20939 << run notifyTextureAvailable
06-19 10:58:42.059 W: Local module descriptor class for com.google.firebase.auth not found.

I have the same problem, have you solved it?What's the solution?There are other options.

@greadking I was able to solve the problem using this custom VideoView. Let me know if it worked.

嗨,很抱歉迟到的回复,我使用NiceVideoPlayer并且工作正常。NiceVideoPlayer < https://libraries.io/github/xiaoyanger0825/NiceVieoPlayer >请按照给定的链接进行操作。谢谢
...
On Mon, Nov 19, 2018 at 2:46 AM Pavan Chilukuri @.***> wrote: @greadking https://github.com/greadking I was able to solve the problem using this custom VideoView https://github.com/chilupa/Android-VideoView. Let me know if it worked. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#65 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AcEQG4vniYfwCXiQbrdIYHVaY72e0Eqdks5uwc4pgaJpZM4N-cuW .

Thank you very much for solving the above problems