adamzarn / AZVideoPlayer

An alternative to SwiftUI's VideoPlayer that includes an overlay button that will transition the player to be presented full screen.
26 stars 5 forks source link

EXC_BAD_ACCESS #4

Closed fidesachates closed 11 months ago

fidesachates commented 11 months ago

I'm not sure how helpful this bug report will be because I'm brand new to ios development and I'm doing it in my spare time, but at the very least if someone else encounters this, there will be an existing record of this happening already.

I more or less copied the example from the README into my code. I used the view in a lazyvstack and rendered a cardview in a foreach. The cardview contained the video player view that has this package. I'm getting EXC_BAD_ACCESS when I scroll too fast through my lazyvstack. One simple way to trigger this is to scroll to the bottom of my feed and then tap the top of the screen (which auto scrolls to the top of the page using the universal ios system behavior).

I determined the issue to be this package because when I replace AZVideoPlayer with VideoPlayer, the issue goes away. I'm happy to try and help provide anything else. The EXC_BAD_ACCESS didn't really come with any stack trace (though it could be that I just don't know where to look for it).

adamzarn commented 11 months ago

@fidesachates There was an actual issue so don't sell yourself short being new to iOS development! I think I was able to resolve the issue, can you pull the latest commit on main and try again?

fidesachates commented 11 months ago

@fidesachates There was an actual issue so don't sell yourself short being new to iOS development! I think I was able to resolve the issue, can you pull the latest commit on main and try again?

Just switched back over. Looks good so far. Thanks for the reply! I'll test it out more further. Out of curiosity which commit was the fix and what was the issue?

adamzarn commented 11 months ago

@fidesachates There was an actual issue so don't sell yourself short being new to iOS development! I think I was able to resolve the issue, can you pull the latest commit on main and try again?

Just switched back over. Looks good so far. Thanks for the reply! I'll test it out more further. Out of curiosity which commit was the fix and what was the issue?

Here is the commit with the fix: e2dde87

The problem is I was using addObserver on the player to detect changes in the time control status but it is an outdated and dangerous API as I found in this SO post: https://stackoverflow.com/questions/66750911/avplayer-addobserver-message-was-received-but-not-handled

The right way to do it is to use observe instead.