mamaral / Onboard

An iOS framework to easily create a beautiful and engaging onboarding experience with only a few lines of code.
MIT License
6.46k stars 765 forks source link

Infinite playing video? #129

Closed whoyawn closed 7 years ago

whoyawn commented 8 years ago

Is there a way to play the background mp4 just one time and then stop?

I saw the initializer

let somePage = OnboardingContentViewController(title: "test", body: "test", videoURL: url, buttonText: "test") { () -> Void in

}

and i was able to get a full screen video playing in the background of my page, but it loops forever.

adrianod1as commented 7 years ago

@huyanhh how did you manage to get full screen?

adrianod1as commented 7 years ago

Also, in my case, I'd like it to loop, which is not happening. Could you show a sample of your code, @huyanhh?

whoyawn commented 7 years ago
let firstPage = OnboardingContentViewController(title: nil, body: firstPageBody, videoURL: generatedVideo(file: video_string), buttonText: "hello") { () -> Void in
  // do something
  }

private func generateVideo(file: String) -> NSURL {

  let bundle = NSBundle.mainBundle()
  let moviePath = bundle.pathForResource(file, ofType: "mp4")
  let movieURL = NSURL(fileURLWithPath: moviePath!)
  return movieURL
}

I didn't do anything special, just imported an mp4 file

adrianod1as commented 7 years ago

I see. You imported to the page. I was importing to the controller. The logic behind it might be different.