Comments (8)
I wasn't able to recreate the crash. I think there may be many other relevant factors. I'll keep looking into possible consequences of these interactions.
One question I have: do you need to play the vid in viewWillAppear
? Having the vid play on viewDidLoad
or init
should be fine. Having it replay in viewWillAppear
restarts the vid from the beginning every time the view controller re-appears. If that's your intended behavior, you could instead access the PlayerLayer
and seek to the beginning, something like:
videoBackground.playerLayer.player?.seek(to: kCMTimeZero)
from swiftvideobackground.
Thanks for the catch. We should have a fix out by today.
from swiftvideobackground.
Actually, after testing the issue seems to be something else. I haven't found the cause yet, but even after adding a check it can fail
from swiftvideobackground.
I see. Yes, I thought it was safe to call removeFromSuperview
without checking for nil, though Apple docs aren't 100% clear. Is it possible to post the other code you're using to get the occasional crash? In the meantime I'll do my own investigation.
from swiftvideobackground.
It's basically just this. And it fails when going back to this viewcontroller on the earlier mentioned line. Earlier versions of the library did not have this problem.
private let videoBackground = VideoBackground()
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
try? videoBackground.play(view: backgroundImage, videoName: "swapOnboarding", videoType: "mp4")
}
from swiftvideobackground.
Actually, some more digging has taken me to the issue.
Before the play is called on the videoBackground
, view.layoutIfNeeded()
is called. If I comment that bit, the library will not crash the app. The crash does not happen on an iPhone X, but it does happen on a 6S. Both running 11.2.5
from swiftvideobackground.
Thanks for the tip!
from swiftvideobackground.
Hey @ndemie, thanks for using SwiftVideoBackground! From the conversation, it seems that you have solved your issue. Therefore, I am going to go ahead and close this. If you are still having issues, feel free to continue the discussion below (and I will reopen this issue), or create a new issue. Thanks again!
from swiftvideobackground.
Related Issues (20)
- Swift 4.2 HOT 1
- Bug, Video playing when app becomes active even though i paused it HOT 1
- Check the download of video HOT 5
- Travis builds failing
- Shared video background? HOT 4
- Update to Swift 5
- Run the video audio in silent mode HOT 4
- Is it possible to use this on a UICollectionViewCell or UITableviewCell ? HOT 3
- Device auto lock doesn't work when video playing (iOS 11) HOT 3
- Run url video offline from cache HOT 1
- Xcode 10.3 compilation issue HOT 5
- Screen flash when resuming.
- How can i get the buffering time of video? Please help me if you have any idea.
- Carthage building issue HOT 4
- Playing different videos on each UITableViewCell HOT 5
- cannot play video saved into phone storage HOT 2
- How do you access the video layer?
- Url to pull video stream in the background? HOT 1
- Support for SPM Integration HOT 1
- How to define that video from Web is loading and how can i display it to user? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swiftvideobackground.