Giter Site home page Giter Site logo

Comments (8)

quanvo87 avatar quanvo87 commented on May 22, 2024 1

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.

quanvo87 avatar quanvo87 commented on May 22, 2024

Thanks for the catch. We should have a fix out by today.

from swiftvideobackground.

ndemie avatar ndemie commented on May 22, 2024

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.

quanvo87 avatar quanvo87 commented on May 22, 2024

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.

ndemie avatar ndemie commented on May 22, 2024

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.

ndemie avatar ndemie commented on May 22, 2024

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.

ndemie avatar ndemie commented on May 22, 2024

Thanks for the tip!

from swiftvideobackground.

dingwilson avatar dingwilson commented on May 22, 2024

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)

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.