Coder Social home page Coder Social logo

pankaj89 / masterexoplayer Goto Github PK

View Code? Open in Web Editor NEW
79.0 3.0 18.0 272 KB

MasterExoPlayer is lightweight utility for playing video inside RecyclerView.

Kotlin 96.83% Java 3.17%
videoinsiderecyclerview recyclerviewadapter exoplayerinsiderecyclerview exoplayer recyclerview tiktok instagram

masterexoplayer's People

Contributors

pankaj89 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

masterexoplayer's Issues

Question: What if two items are visible at the same time?

As far as I understand from the docs, the player by default plays the video on an item if 75% of the item is visible. What if items are shorter, resulting in 2/3 items visible at the same time, what player will get priority? Or will all of them start to play?

Does this library have cache support?

Does this library cache vides and olay cached videos arter first olay or download video every time?

İf it doesnt have cache support how can i add it?

Player Issue

In Recyclerview- First Video plays well, but when I Scroll to 2nd 3rd position and come back to first. First video did not loaad. And 3rd video keeps play.

App crashed after reloading data to recycler view

Hi pankaj,

App is getting crashed after loading data to recycler view , Please look into the issue

java.lang.IllegalStateException: recyclerView.getChildAt(0) must not be null
at com.master.exoplayer.MasterExoPlayerHelper$onScrollListener$1.onScrolled(MasterExoPlayerHelper.kt:191)
Thanks in advance

Video volume not working properly in RecyclerView

When we used image and videos in same recycler view, then on smooth scroll video onStop() method is not calling & video is paused but video volume is still playing in background until next video is coming on the screen view.

reziseMode.AspectRatioFrameLayout

Hi! I hope you well!
I have been working with your library and its really helpfull. I just have one question,
I want to set Resize Mode to the player view to be RESIZE_MODE_FIT but after so many tries I can't achieve this. is it possible? and how could I do this?
thanks in advance

LifeCycleOwner issue in case of nested.

masterExoPlayerHelper.makeLifeCycleAware(this)
I used this in case of Nested List as List inside list. But when i reach to inner screen the video keeps play.

delay in play

Hi first of all thanks for the best solution.
I am facing an issue. I am using HLS videos. But it takes 2-3 second to play the video, Till that time it shows black screen.
Even if a video played before and again if I Switch to old video still it behave like 2-3 sec black screen then video. Is any possibility to use preLoad while HLS.

Thanks

Library crashing when providing .m3u8 file

The library is crashing when I provide .m3u8 file format. Below is the crash logs:

FATAL EXCEPTION: ExoPlayerImplInternal:Handler
Process: com.------, PID: 9969
java.lang.AbstractMethodError: abstract method "void com.google.android.exoplayer2.source.BaseMediaSource.prepareSourceInternal(com.google.android.exoplayer2.upstream.TransferListener)"
at com.google.android.exoplayer2.source.BaseMediaSource.prepareSource(BaseMediaSource.java:140)
at com.google.android.exoplayer2.source.CompositeMediaSource.prepareChildSource(CompositeMediaSource.java:101)
at com.google.android.exoplayer2.source.LoopingMediaSource.prepareSourceInternal(LoopingMediaSource.java:76)
at com.google.android.exoplayer2.source.BaseMediaSource.prepareSource(BaseMediaSource.java:140)
at com.google.android.exoplayer2.ExoPlayerImplInternal.prepareInternal(ExoPlayerImplInternal.java:398)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:285)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:246)
at android.os.HandlerThread.run(HandlerThread.java:67)

Please help to resolve this

First video doesn't play.

I'm using your library. And latest version has a lot of improvments. But first video doesnt play.
I attached a listener to player.

 @Override
 public void onError(@org.jetbrains.annotations.Nullable ExoPlaybackException e) {
       holder.videoProgress.setVisibility(View.GONE);
       holder.muteControlLayout.setVisibility(View.INVISIBLE);
 }

Listener triggers on error method when I scroll recycler view to top. I mean really top. On error method only triggers when there is no more space to scroll. and of course first video doesnt play no matter what.

I tried to investigate error but seems like Listener throws null error.

When I check

i(e==null){
    //its true
}

Do you have any Idea why this happens?

Suggestions.

I have tried your library and it works great
and do what it promises. But I have some suggestions.

1- in built cache support( we have already talked about this).

2- in built thumbnail. - we can set an imageview to masterExoPlayer and can use that image view as thumbnail but it can be easier. MasterExoPlayer can have its own thumbnail imageview instead of separate one. And we can use it like this

Glide.with(this).load(thumbnailUrl).into(holder.masterExoPlayer.thumbnailImageView);

3- thumbnails shouldn't disappear when player shown. - as long as player starts playing thumbnail disappear but until video loading finishes we just stare at black screen. Thumbnail should stay until video actually starts playing. Yes we have an option to how many seconds to delay thumbnail before disappear. But I think that's not enough. We cannot measure how many seconds more thumbnail should be visible. That time can change depends on connection speed.

4- Paused video should start from where it lefts when connected activity starts. - player stop video when connected activity is Paused that's works great but video doesn't start when activity's OnResume. And if player controllers is hidden there is no way to start that video unless you scroll down then scroll back to that video.

5- there is no way to unmute video if we started videos muted. - Video controllers also don't have an option to unmute video. Tap to unmute option like Instagram would be great.

6- loading indicator - there should be a loading bar or something similar to show user that object is video and it loading

Like I said in title this things are just suggestions. Your library works great. I'm glad to see that you are working on this library.

Mute Control in adapter doesnt work.

This is my code:

holder.muteIcon.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            if(holder.masterExoPlayer.isMute()){
                                holder.masterExoPlayer.setMute(false);
                                Log.e("Mute Contoll: ",String.valueOf(holder.masterExoPlayer.isMute()));
                                holder.muteIcon.setImageDrawable(holder.masterExoPlayer.getContext().getResources().getDrawable(R.drawable.ic_unmute));
                            }
                            if(!holder.masterExoPlayer.isMute()){
                                holder.masterExoPlayer.setMute(true);
                                Log.e("Mute Contoll: ",String.valueOf(holder.masterExoPlayer.isMute()));
                                holder.muteIcon.setImageDrawable(holder.masterExoPlayer.getContext().getResources().getDrawable(R.drawable.ic_mute));
                            }
                        }
                    });

And this is the output:

2020-02-02 22:50:47.607 6663-6663 E/Mute Contoll:: true
2020-02-02 22:50:52.403 6663-6663 E/Mute Contoll:: false
2020-02-02 22:50:52.405 6663-6663 E/Mute Contoll:: true
2020-02-02 22:50:54.167 6663-6663 E/Mute Contoll:: false
2020-02-02 22:50:54.168 6663-6663 E/Mute Contoll:: true
2020-02-02 22:50:55.225 6663-6663 E/Mute Contoll:: false
2020-02-02 22:50:55.227 6663-6663 E/Mute Contoll:: true

Whenever I try to unmute player it automatically mutes it again.

This is how ı set up MasterExoPlayerHelper in activity.

MasterExoPlayerHelper helper = new MasterExoPlayerHelper(Objects.requireNonNull(getActivity()),R.id.postvideo2,true,0.75f
                ,MuteStrategy.ALL,true,false,0,10);
        helper.makeLifeCycleAware((MainActivity)getActivity());
        helper.attachToRecyclerView(recyclerView);

When I set default mute to false. Player has sound and I can mute the player but I can't unmute it again. Player stuck in mute mode. Whenever I try to set mute to false it automatically set it to true again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.