Skip to content
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

Video loading reproduce in another views #24

Closed
alexviquez opened this issue Mar 16, 2018 · 10 comments
Closed

Video loading reproduce in another views #24

alexviquez opened this issue Mar 16, 2018 · 10 comments

Comments

@alexviquez
Copy link

Hello, I have a problem with the player, in the case of me to load the player and leave the view after it, then the video not loading is not uninitialized, this generates that the audio of the video live in the app without I can remove it, this only happens when it is loading, I play and I leave the view without allowing to play the video.

@andreipitis
Copy link
Owner

andreipitis commented Mar 17, 2018

Hi @alexviquez ,

There was an issue where an instance of ASPVideoPlayer would be released only after a delay of 3 seconds.

If this was your issue then it should be fixed in the latest version, however if the player never gets deallocated for you, you may have a retain cycle somewhere.

@MattiaConfalonieri
Copy link

Hi, i also have this bug. is it solved? I have installed via Pod.

@andreipitis
Copy link
Owner

Hi @MattiaConfalonieri , what version are you using? This should be fixed since version 4.0.

@MattiaConfalonieri
Copy link

Hi, the last one (4.2.0) with the pod...

I have a controller with the video that autoplay when read in the viewdidload.
When user dismiss the controller I stop the video in the viewWillDisappea trough .stopVideo()
After that close the app in the background wait 2/3 minutes and open the app, when the app return in foreground you can ear the video audio from the previous dismissed controller.

@andreipitis
Copy link
Owner

I have done some quick tests but I am unable to reproduce your issue. My guess is that you have a reference cycle somewhere in your code which leads to the player not deallocating properly, which in turn may cause your issue.

@MattiaConfalonieri
Copy link

Sorry but I can't see nothing wrong in my controller...
https://pastebin.com/iHk2va2X

@andreipitis
Copy link
Owner

Lines 45, 48 and 53. The closures capture a strong reference to self (the view controller), and the ViewController has a reference to the player which leads to a retain cycle. Just change the closures to capture self as weak or unowned and it should fix it.

Example:

videoPlayer.readyToPlayVideo = { [weak self] in
            self?.videoPlayer.playVideo()
}

or

videoPlayer.readyToPlayVideo = { [unowned self] in
            self.videoPlayer.playVideo()
}

@MattiaConfalonieri
Copy link

Sorry, but nothing change... still have the bug

@andreipitis
Copy link
Owner

It's possible that you have other retain cycles that I missed. Is your view controller getting deallocated when dismissed? If not then there may be some other issues.
If the player gets deallocated properly then there should be no way for it to play anything anymore.

@MattiaConfalonieri
Copy link

Thanks for help. mmmmm I think you right, maybe there is some shit in my code... thanks I looking for

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants