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.

Overview

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 and API to track it.

It consists from two libraries:

  1. Video-Player-Manager - it gives the ability to invoke MediaPlayer methods in a background thread. It has utilities to have only one playback when multiple media files are in the list. Before new playback starts, it stops the old playback and releases all the resources.

  2. List-Visibility-Utils - it's a library that tracks the most visible item in the list and notifies when it changes. NOTE: there should be the most visible item. If there will be 3 or more items with the same visibility percent the result might be unpredictable. Recommendation is to have few views visible on the screen. View that are big enough so that only one view is the most visible, look at the demo below.

These two libraries combined are the tool to get a Video Playback in the scrolling list: ListView, RecyclerView.

Details of implementation

Medium

Android_weekly

Android Arsenal

Problems with video list

  1. We cannot use usual VideoView in the list. VideoView extends SurfaceView, and SurfaceView doesn't have UI synchronization buffers. All this will lead us to the situation where video that is playing is trying to catch up the list when you scroll it. Synchronization buffers are present in TextureView but there is no VideoView that is based on TextureView in Android SDK version 15. So we need a view that extends TextureView and works with Android MediaPlayer.

  2. Almost all methods (prepare, start, stop etc...) from MediaPlayer are basically calling native methods that work with hardware. Hardware can be tricky and if will do any work longer than 16ms (And it sure will) then we will see a lagging list. That's why need to call them from background thread.

Usage

Add this snippet to your project build.gradle file:

buildscript {
    repositories {
        jcenter()
    }
}

Usage of Video-Player-Manager

dependencies {
    compile 'com.github.danylovolokh:video-player-manager:0.2.0'
}

Put multiple VideoPlayerViews into your xml file. In most cases you also need a images above that will be shown when playback is stopped.

<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <!-- Top Player-->
        <com.volokh.danylo.video_player_manager.ui.VideoPlayerView
            android:id="@+id/video_player_1"
            android:layout_height="0dp"
            android:layout_width="match_parent"
            android:layout_weight="1"
            />

        <com.volokh.danylo.video_player_manager.ui.VideoPlayerView
            android:id="@+id/video_player_2"
            android:layout_height="0dp"
            android:layout_width="match_parent"
            android:layout_weight="1"
            />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <!-- Top Player-->
        <ImageView
            android:id="@+id/video_cover_1"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:scaleType="centerCrop"
            android:layout_weight="1"/>

        <ImageView
            android:id="@+id/video_cover_2"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:scaleType="centerCrop"
            android:layout_weight="1"/>
    </LinearLayout>

Now you can use SingleVideoPlayerManager to playback only a single video at once:

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

    }
});
//... some code

mVideoPlayer_1 = (VideoPlayerView)root.findViewById(R.id.video_player_1);
mVideoPlayer_1.addMediaPlayerListener(new SimpleMainThreadMediaPlayerListener(){
   @Override
   public void onVideoPreparedMainThread() {
    // We hide the cover when video is prepared. Playback is about to start
    mVideoCover.setVisibility(View.INVISIBLE);
   }

   @Override
   public void onVideoStoppedMainThread() {
   // We show the cover when video is stopped
    mVideoCover.setVisibility(View.VISIBLE);
   }

   @Override
   public void onVideoCompletionMainThread() {
       // We show the cover when video is completed
       mVideoCover.setVisibility(View.VISIBLE);
   }
});
mVideoCover = (ImageView)root.findViewById(R.id.video_cover_1);
mVideoCover.setOnClickListener(this);

mVideoPlayer_2 = (VideoPlayerView)root.findViewById(R.id.video_player_2);
mVideoPlayer_2.addMediaPlayerListener(new SimpleMainThreadMediaPlayerListener(){
   @Override
   public void onVideoPreparedMainThread() {
       // We hide the cover when video is prepared. Playback is about to start
        mVideoCover2.setVisibility(View.INVISIBLE);
   }

   @Override
   public void onVideoStoppedMainThread() {
        // We show the cover when video is stopped
      mVideoCover2.setVisibility(View.VISIBLE);
   }

   @Override
   public void onVideoCompletionMainThread() {
      // We show the cover when video is completed
      mVideoCover2.setVisibility(View.VISIBLE);
   }
});
mVideoCover2 = (ImageView)root.findViewById(R.id.video_cover_2);
mVideoCover2.setOnClickListener(this);

// some code
@Override
public void onClick(View v) {
        switch (v.getId()){
            case R.id.video_cover_1:
                mVideoPlayerManager.playNewVideo(null, mVideoPlayer_1, "http:\\url_to_you_video_1_source");
                break;
            case R.id.video_cover_2:
                mVideoPlayerManager.playNewVideo(null, mVideoPlayer_2, "http:\\url_to_you_video_2_source");
                break;
        }
}

The Demo of Video-Player-Manager:

video_player_manager_demo

Usage of List-Visibility-Utils

dependencies {
    compile 'com.github.danylovolokh:list-visibility-utils:0.2.0'
}

The models of your adapter need to implement ListItem

public interface ListItem {
    int getVisibilityPercents(View view);
    void setActive(View newActiveView, int newActiveViewPosition);
    void deactivate(View currentView, int position);
}

This messes up a bit with separating model from the logic. Here you need to handle the login in the model.

The ListItemsVisibilityCalculator will call according methods to:

  1. Get view visibility

  2. Set this item to active

  3. Deactivate the item

// some code...
private final ListItemsVisibilityCalculator mListItemVisibilityCalculator =
            new SingleListViewItemActiveCalculator(new DefaultSingleItemCalculatorCallback(), mList);
// some code...

mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {

            @Override
            public void onScrollStateChanged(RecyclerView recyclerView, int scrollState) {
                mScrollState = scrollState;
                if(scrollState == RecyclerView.SCROLL_STATE_IDLE && !mList.isEmpty()){

                    mListItemVisibilityCalculator.onScrollStateIdle(
                            mItemsPositionGetter,
                            mLayoutManager.findFirstVisibleItemPosition(),
                            mLayoutManager.findLastVisibleItemPosition());
                }
            }

            @Override
            public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
                if(!mList.isEmpty()){
                    mListItemVisibilityCalculator.onScroll(
                            mItemsPositionGetter,
                            mLayoutManager.findFirstVisibleItemPosition(),
                            mLayoutManager.findLastVisibleItemPosition() - mLayoutManager.findFirstVisibleItemPosition() + 1,
                            mScrollState);
                }
            }
        });

mItemsPositionGetter = new RecyclerViewItemPositionGetter(mLayoutManager, mRecyclerView);

    @Override
    public void onResume() {
        super.onResume();
        if(!mList.isEmpty()){
            // need to call this method from list view handler in order to have filled list

            mRecyclerView.post(new Runnable() {
                @Override
                public void run() {

                    mListItemVisibilityCalculator.onScrollStateIdle(
                            mItemsPositionGetter,
                            mLayoutManager.findFirstVisibleItemPosition(),
                            mLayoutManager.findLastVisibleItemPosition());

                }
            });
        }
    }
	

The Demo of List-Visibility-Utils:

visibility_utils_demo

Usage in scrolling list (ListView, RecyclerView)

Add this snippet to your module build.gradle file:

dependencies {
    compile 'com.github.danylovolokh:video-player-manager:0.2.0'
    compile 'com.github.danylovolokh:list-visibility-utils:0.2.0'
}

Here is the relevant code combanation of two libraries fro implementing Video Playback in scrolling list.

// Code of your acitivty
    /**
     * Only the one (most visible) view should be active (and playing).
     * To calculate visibility of views we use {@link SingleListViewItemActiveCalculator}
     */
    private final ListItemsVisibilityCalculator mVideoVisibilityCalculator =
            new SingleListViewItemActiveCalculator(new DefaultSingleItemCalculatorCallback(), mList);

    /**
     * ItemsPositionGetter is used by {@link ListItemsVisibilityCalculator} for getting information about
     * items position in the RecyclerView and LayoutManager
     */
    private ItemsPositionGetter mItemsPositionGetter;

    /**
     * Here we use {@link SingleVideoPlayerManager}, which means that only one video playback is possible.
     */
    private final VideoPlayerManager<MetaData> mVideoPlayerManager = new SingleVideoPlayerManager(new PlayerItemChangeListener() {
        @Override
        public void onPlayerItemChanged(MetaData metaData) {

        }
    });

    private int mScrollState = AbsListView.OnScrollListener.SCROLL_STATE_IDLE;
    
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

	// fill the list of items with an items

	// some initialization code here

        VideoRecyclerViewAdapter videoRecyclerViewAdapter = new VideoRecyclerViewAdapter(mVideoPlayerManager, getActivity(), mList);

        mRecyclerView.setAdapter(videoRecyclerViewAdapter);
        mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {

            @Override
            public void onScrollStateChanged(RecyclerView recyclerView, int scrollState) {
                mScrollState = scrollState;
                if(scrollState == RecyclerView.SCROLL_STATE_IDLE && !mList.isEmpty()){

                    mVideoVisibilityCalculator.onScrollStateIdle(
                            mItemsPositionGetter,
                            mLayoutManager.findFirstVisibleItemPosition(),
                            mLayoutManager.findLastVisibleItemPosition());
                }
            }

            @Override
            public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
                if(!mList.isEmpty()){
                    mVideoVisibilityCalculator.onScroll(
                            mItemsPositionGetter,
                            mLayoutManager.findFirstVisibleItemPosition(),
                            mLayoutManager.findLastVisibleItemPosition() - mLayoutManager.findFirstVisibleItemPosition() + 1,
                            mScrollState);
                }
            }
        });
        mItemsPositionGetter = new RecyclerViewItemPositionGetter(mLayoutManager, mRecyclerView);

        return rootView;
    }

    @Override
    public void onResume() {
        super.onResume();
        if(!mList.isEmpty()){
            // need to call this method from list view handler in order to have filled list

            mRecyclerView.post(new Runnable() {
                @Override
                public void run() {

                    mVideoVisibilityCalculator.onScrollStateIdle(
                            mItemsPositionGetter,
                            mLayoutManager.findFirstVisibleItemPosition(),
                            mLayoutManager.findLastVisibleItemPosition());

                }
            });
        }
    }

    @Override
    public void onStop() {
        super.onStop();
        // we have to stop any playback in onStop
        mVideoPlayerManager.resetMediaPlayer();
    }    

When visibility utils calls method "setActive" on your implementation of ListItem you have to call "playNewVideo". Please find the working code on this Demo application.

    /**
     * When this item becomes active we start playback on the video in this item
     */
    @Override
    public void setActive(View newActiveView, int newActiveViewPosition) {
        VideoViewHolder viewHolder = (VideoViewHolder) newActiveView.getTag();
        playNewVideo(new CurrentItemMetaData(newActiveViewPosition, newActiveView), viewHolder.mPlayer, mVideoPlayerManager);
    }
    
    @Override
    public void playNewVideo(MetaData currentItemMetaData, VideoPlayerView player, VideoPlayerManager<MetaData> videoPlayerManager) {
        videoPlayerManager.playNewVideo(currentItemMetaData, player, mDirectUrl);
    }

Demo of usage in scrolling list (ListView, RecyclerView)

recycler_view_demo list_view_demo

AndroidX support

Migration to AndroidX gladly provided by https://github.com/prensmiskin

License

Copyright 2015 Danylo Volokh

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Comments
  • onBufferingUpdateMainThread does not trigger

    onBufferingUpdateMainThread does not trigger

    It seems that the writing is very messy, the cached method onBufferingUpdateMainThread does not trigger and is not conducive to modification. It is hoped that a complete demo can include the display update of the cache.

    opened by qssq1 5
  • Nothing gets displayed in the VideoPlayerView

    Nothing gets displayed in the VideoPlayerView

    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.
    
    opened by chilupa 4
  • Gradle ?

    Gradle ?

    @Danylo2006 , thank for awesome library, perfect if pause/play when touch like facebook app. Can you add this library to gradle ?? And, have a problem happens when i assign class VideoPlayerView to xml, the Android Studio IDE freeze and not do anything. i don't know why, i did something wrong ??

    opened by tuanth89 4
  • Error inflating class VideoPlayerView

    Error inflating class VideoPlayerView

    I did follow the exact steps with my RecyclerView but cannot inflate the VideoPlayerView inside the row. Help is greatly appreciated ! Here's a part of my logcat, adapter's onCreateView and Model: android.view.InflateException: Binary XML file line #66: Error inflating class

                                                                       at android.view.LayoutInflater.createView(LayoutInflater.java:633)
                                                                       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
                                                                       at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
                                                                       at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
                                                                       at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
                                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
                                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
                                                                       at com.enthu.nocto.models.userInsightFeed.Insight.createView(Insight.java:409)
                                                                       at com.enthu.nocto.views.adapters.InsightsAdapter.onCreateViewHolder(InsightsAdapter.java:80)
                                                                       at com.enthu.nocto.views.adapters.InsightsAdapter.onCreateViewHolder(InsightsAdapter.java:50)
                                                                       at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6367)
                                                                       at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5555)```
    
    
    
    @Override
        public VideoViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    	    Insight insight = mInsightList.get(viewType);
    	    View resultView = insight.createView(parent, mContext.getResources().getDisplayMetrics().widthPixels);
    	    return new VideoViewHolder(resultView);
        }
    
    
    
    public View createView(ViewGroup parent, int screenWidth) {
    		View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_adapter_insights, parent, false);
    		ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
    		layoutParams.height = screenWidth;
    		final VideoViewHolder videoViewHolder = new VideoViewHolder(view);
    		view.setTag(videoViewHolder);
    
    		videoViewHolder.mVideoPlayerView.addMediaPlayerListener(new MediaPlayerWrapper.MainThreadMediaPlayerListener() {
    			@Override
    			public void onVideoSizeChangedMainThread(int width, int height) {
    
    			}
    
    			@Override
    			public void onVideoPreparedMainThread() {
    				videoViewHolder.mVCover.setVisibility(View.GONE);
    			}
    
    			@Override
    			public void onVideoCompletionMainThread() {
    				videoViewHolder.mVCover.setVisibility(View.VISIBLE);
    			}
    
    			@Override
    			public void onErrorMainThread(int what, int extra) {
    				videoViewHolder.mVCover.setVisibility(View.VISIBLE);
    			}
    
    			@Override
    			public void onBufferingUpdateMainThread(int percent) {
    
    			}
    
    			@Override
    			public void onVideoStoppedMainThread() {
    				videoViewHolder.mVCover.setVisibility(View.VISIBLE);
    			}
    		});
    
    
    		return view;
    	}
    
    opened by DebdeepG 3
  • IllegalStateException: cannot stop. Player in mState ERROR

    IllegalStateException: cannot stop. Player in mState ERROR

    Hi danylovolokh! I found a stable crash for a MediaPlayer when I scroll fast up/down 6 videos. Please help.

    java.lang.IllegalStateException: cannot stop. Player in mState ERROR at com.volokh.danylo.video_player_manager.ui.MediaPlayerWrapper.stop(MediaPlayerWrapper.java:433) at com.volokh.danylo.video_player_manager.ui.VideoPlayerView.stop(VideoPlayerView.java:186) at com.volokh.danylo.video_player_manager.player_messages.Stop.performAction(Stop.java:19) 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:1080) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) at java.lang.Thread.run(Thread.java:841)

    opened by neestell 2
  • Issues with Butterknife

    Issues with Butterknife

    Hi, First of all a huge ton of thanks for getting this library out in the wild. I was looking for such a solution for months. I have ran in to a problem with butterknife. When i included your library in my project the viewholder bindings give an error with Butterknife. And when i remove your library from dependencies the Bindings work correctly

    opened by rajivenator 2
  • How to switch video to fullscreen?

    How to switch video to fullscreen?

    Your method is great。 I am wondering how to switch video to fullscreen, i have tried to use a move textureview to a new Container,but the video will playback for a little time。Do you have any idea? thanks

    opened by liwshuo 2
  • How can video urls of youtube and vimeo can be played using this library.

    How can video urls of youtube and vimeo can be played using this library.

    I am getting this error when I try to play a youtube video using this library.

    java.lang.RuntimeException: java.io.IOException: setDataSource failed. at com.volokh.danylo.video_player_manager.ui.VideoPlayerView.setDataSource(VideoPlayerView.java:263)

    I am passing the youtube url www.youtube.com/embed/GYFDRoJtfGM?wmode=opaque&autoplay=1 but it is not working then which url do I need to pass in order to get this working. I want to play videos from vimeo also as same issue is coming when I play vimeo videos also.

    opened by manisha-jain-bs 1
  • A current video is not resumed in RecyclerView

    A current video is not resumed in RecyclerView

    If I leave(home pressed or go to another app) an Activity with a list of your videos(RecyclerView) and come back all videos are stopped. There is a quick fix: I should recreate VideoVisibilityCalculator before onScrollStateIdle in onResume(); Is there a more elegant way? Thanks

    opened by neestell 1
  • mediaplayer.prepareAsync

    mediaplayer.prepareAsync

    hi danylovolokh, In consideration of the asynchronous, VideoViewPlayer called prepare(), i want to use prepareAsync() and add a callback. BTW:I think you can put the Features on the schedule. Thx~ -.0

    opened by wy353208214 1
  • Is VideoPlayerManager work with ExoPlayer?

    Is VideoPlayerManager work with ExoPlayer?

    Hi,

    firstly, thank You for all the work You did! It's a really cool project.

    But I have one question, is it compatibile with Google ExoPlayer -> https://github.com/google/ExoPlayer ?

    Thanks, Peter

    opened by PiotrWpl 1
  • Video resolution is bit lower than ExoPlayer

    Video resolution is bit lower than ExoPlayer

    I am implementing an Instagram kind of auto-play video feature in my app, But before updating RecyclerView UI as per this library suggestion. I used this library VideoPlayerView in my application where I am playing video using ExoPlayer. But I am seeing the difference in the resolution. This library plays video in low resolution that's why it's a bit pixelated at the bottom whereas ExoPlayer plays video in better resolution. I also tried to set up the UI ratio a bit smaller like 16:9 and 4:3 but the same effect.

    FYI, I am using Firebase Storage to store video and loading from their provided download link with the token.

    Is there any way to pass the video resolution?

    opened by bipinvaylu 0
  • RuntimeException: cannot perform action, you are not holding a lock

    RuntimeException: cannot perform action, you are not holding a lock

    I have ported this VideoPlayerManager in my app. Whenever I refresh layout to get new videos from API, next video is not automatically playing. While debuging I found below exception. Has any one seen this problem? Any pointer or suggestions to fix this?

    java.lang.RuntimeException: cannot perform action, you are not holding a lock at com.volokh.danylo.video_player_manager.MessagesHandlerThread.clearAllPendingMessages(SourceFile:98) at com.volokh.danylo.video_player_manager.manager.SingleVideoPlayerManager.startNewPlayback(SourceFile:212) at com.volokh.danylo.video_player_manager.manager.SingleVideoPlayerManager.playNewVideo(SourceFile:90) at chat.chit.com.app.socialDetail.video_manager.VideoItem.playNewVideo(SourceFile:111) at chat.chit.com.app.socialDetail.video_manager.BaseVideoItem.setActive(SourceFile:64) at chat.chit.com.app.home.home.HomeFragment.d(SourceFile:897) at chat.chit.com.app.home.home.f.run(lambda) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:7406) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

    opened by RameshJangama 0
  • java.lang.RuntimeException: cannot be in main thread

    java.lang.RuntimeException: cannot be in main thread

    Process: com.volokh.danylo.videolist, PID: 11999 java.lang.RuntimeException: cannot be in main thread at com.volokh.danylo.video_player_manager.ui.VideoPlayerView.checkThread(VideoPlayerView.java:117) at com.volokh.danylo.video_player_manager.ui.VideoPlayerView.setOnVideoStateChangedListener(VideoPlayerView.java:288) at com.volokh.danylo.videolist.video_list_demo.adapter.items.BaseVideoItem.setActive(BaseVideoItem.java:51) at com.volokh.danylo.visibility_utils.calculator.DefaultSingleItemCalculatorCallback.activateNewCurrentItem(DefaultSingleItemCalculatorCallback.java:28) at com.volokh.danylo.visibility_utils.calculator.SingleListViewItemActiveCalculator.setCurrentItem(SingleListViewItemActiveCalculator.java:359) at com.volokh.danylo.visibility_utils.calculator.SingleListViewItemActiveCalculator.calculateMostVisibleItem(SingleListViewItemActiveCalculator.java:189) at com.volokh.danylo.visibility_utils.calculator.SingleListViewItemActiveCalculator.onScrollStateIdle(SingleListViewItemActiveCalculator.java:159) at com.volokh.danylo.videolist.video_list_demo.fragments.VideoRecyclerViewFragment$3.run(VideoRecyclerViewFragment.java:145) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7073) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)

    opened by manegirish 1
  • method inUiThread was not working as expected

    method inUiThread was not working as expected

    App was crashing with RuntimeException("this should be called in Main Thread") due to method "inUiThread" returning false even though it is running in main thread . After changing logic to check the main thread app is working fine.

    opened by upender-reddy 0
Owner
Danylo Volokh
Hi, Welcome to my github :)
Danylo Volokh
Android Application that plays music through a Spotify API based on a user's current location found through Google Maps API and also checking Google Weather API.

GeoStereo Android Application that plays music through a Spotify API based on a user's current location found through Google Maps API and also checkin

Jonah Douglas 1 Jun 16, 2022
SocyMusic is an open-source Android music player written in Java with the aim of creating an easy-to-use app for exchanging and listening to top-quality music. Help us create it!

SocyMusic SocyMusic is an open-source Android music player written entirely in Java. It's objectives are to provide top-quality music to everyone for

Benji 23 Dec 26, 2022
Lightweight and Material designed Music Player

Music Player Lightweight and Material designed Music Player Based on Phonograph Features: Settings: Active tabs management Themes: Light, Dark, Black

Max 273 Dec 11, 2022
Android app that uses Spotify API to recommend new music based on your listening history

Android app that uses Spotify API to recommend new music based on your listening history. Written in Kotlin and uses Spotify Web API and Android SDK. New music is presented in swipe cards where a left swipe plays the next song and a right swipe can add the app to your liked songs in Spotify.

null 3 Jun 5, 2022
A material designed music player for Android

Vinyl Music Player A material designed local music player for Android. Forked from Phonograph; makes all Pro features free, as they used to be. Additi

Adrien Poupa 581 Dec 30, 2022
ZExoRecyclerPlayer is an Android library that allows developers to easily create RecyclerView with Exoplayer .

ZExoRecyclerPlayer Description ZExoRecyclerPlayer is an Android library that allows developers to easily create RecyclerView with Exoplayer . Please f

mohammed alzoubi 4 Dec 12, 2022
A simple library for parsing and playing links from YouTube, YouTube Music, Vimeo and Rutube is WebView without the need to connect api data services. Request caching is available now

Android Oembed Video A simple library for parsing and playing links from YouTube, YouTube Music, Vimeo and Rutube and others in the WebView without th

Alexey Mostovoy 32 Oct 8, 2022
An easy to use Instagram Video Downloader library for android apps.

Instagram-Video-Downloader-Library An easy to use library for directly download videos from ig reels, igtv. Implementation Step 1. Add the JitPack rep

Abhay 16 Dec 7, 2022
The official Android client library for api.video

api.video Android client api.video is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing

api.video 7 Dec 3, 2022
The androidx.media3 support libraries for media use cases, including ExoPlayer, an extensible media player for Android

AndroidX Media AndroidX Media is a collection of libraries for implementing media use cases on Android, including local playback (via ExoPlayer) and m

Android Jetpack 310 Dec 29, 2022
FPS Display Mod for Minecraft with an easy-to-use ingame configuration: /fps

FPS-Display The FPS Display Mod is made to be used with the Minecraft Forge Load

null 3 Nov 26, 2022
A Java API to read, write and create MP4 files

Build status: Current central released version 1.x branch: Current central released version 2.x branch: Java MP4 Parser A Java API to read, write and

Sebastian Annies 2.6k Dec 30, 2022
Wynncraft API Wrapper - Simple wrapper to get Wynncraft Stats of a player or a guild and more in Java

WynncraftAPIWrapper Simple wrapper to get Wynncraft Stats of a player or a guild

byBackfish 3 Sep 27, 2022
Convert your YouTube channel into a native Android app using YouTube Data API v3.

Convert your YouTube channel into an app. Screenshots • Description • Features • Configuration • Documentation Screenshots Description Channelify is a

Aculix Technologies LLP 121 Dec 26, 2022
api.video Android player

api.video is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.

api.video 9 Dec 15, 2022
Autodownload MP3 API With Kotlin

Autodownload MP3 API Overview This project leverages Spring Boot, Google's YouTube API, and youtube-dl to provide an API to download videos and conver

Julien 1 Jul 1, 2022
Sandbox project for practice: Media Streaming with Exoplayer (via Android Development tutorial)

Media streaming with ExoPlayer The code in this repository accompanies the Media streaming with ExoPlayer codelab. If you are looking to get started w

Jeannille Hiciano 1 Nov 29, 2021
⚡️First Semester's Final Project ⚡️

HalalSpotify HalalSpotify is an app to listen quran recites, islamic study, etc . . . . Description Featuring all of the famous qari around the world

tznxx 6 Nov 9, 2022
TravelAppDesign - Add local project to git repo

CustomView, MotionMayout e Animation Projeto Android em linguagem Kotlin, basead

Bernardo Michel Slailati 1 Feb 18, 2022