-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: repeat video on iOS with AVPlayerLooper #2922
base: master
Are you sure you want to change the base?
fix: repeat video on iOS with AVPlayerLooper #2922
Conversation
code looks ok to me, but we would need additionnal testers, |
I've tested it some more on my own and made some improvements, will push so that is the version tested |
Hi |
FYI I haven't worked with native libraries before, I just wanted to help getting this fix in since our project needs it. So I didn't find a better way to test this than running it from |
@swemail 😅 seems like we are both rather new to this. So what I tried to test it was We are currently using react-native 0.64.1 and react 17.0.1 |
Ok, I've tried in our app too, installing via |
This is the error I get from an
Xcode gives me this:
|
Ok, I've only made changes to the iOS implementation. The issue you posted was referring to version 5.2.0 of EDIT: |
oh yeah that makes totally sense. I completely overlooked that your fork was based on v6 of the react-native-video library. Sorry for that. |
That is strange. Should not have to do with my change, I didn't change anything regarding Android. I though I didn't have sound on my Android emulator but had to go in and adjust the sound on the emulator itself. Seems like a stretch but worth checking |
@MitoMonkey Sorry for all the confusion I create here but I was not planning on making a PR for the 5.2.1 version but did today in hopes of us using the library version instead of our fork. 6.0.0 could be too long for us to wait. Could it be that there are changes on top of |
I'm not sure what was the problem with the audio in Android Emulator, but a restart of my macbook + cold boot of the emulator + delete and re-install of node-modules solved the problem. So apparently has nothing to do with your PR. Sorry about the unnecessary confusion here. The problem I am facing now is that we had patches for v5.2.0 in place because of the problem described here #2371 . Theoretically the PR is merged and should the problem should be solved in v5.2.1, but for us somehow it isn't. But that is an issue to be discussed somewhere else. Thanks a lot again @swemail for this fix for the loop function. It is really a big fix for our app. |
Glad to hear it worked, at least regarding this feature @MitoMonkey! It was really important for our app too. Thank you for sticking it out and testing it. I guess that what's been tested is actually 2926 so if you could throw in a comment there that you tested it I would be so grateful. The change is the same for both versions but of course in different languages |
_playerObserver.playerItem = nil | ||
|
||
if #available(iOS 10.0, *) { | ||
self._player = AVQueuePlayer(playerItem: playerItem) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@freeboub We're running into this issue. Any chance this will get merged+released? |
Hello and thank you for a great library! This is a shot at the fix proposed in #2817
To test this is just to run the basic example in this repo. Maybe remove the alert at the end to get the sense of the smoother repeat 😄
The solution proposed is to create a
AVQueuePlayer
with aAVPlayerLooper
if supported (iOS >= 10) and fall back to the previous usedAVPlayer
if it's not. TheAVPlayerLooper
need to be references to not be disposed. The variable holding that reference is typed toNSObject
to make it compatible with previous iOS versions not supportingAVPlayerLooper
. The order of things matter and I had to move passing theplayerItem
to theplayerObserver
until after initiation of the player