Reputation: 603
I'm trying to play a video on clic of a button ( it should start the video in fullscreen) Using GVR SDK for IOs in Swift.
I've been following this tutorial to make the player working in swift;
https://www.raywenderlich.com/136692/introduction-google-cardboard-ios
but it idpslay the video on the view controller.
Current on my view controller I have a button, on press, it should start to play the video in full screen.
For this I tried to create the following action:
@IBAction func videoButton(_ sender: UIButton) {
var url = URL(string: "https://myvideo.mp4")
var videoController = GVRVideoView(nibName: "GVRVideoView", bundle: nil, url: url)
videoController.vrMode(true)
if !self.presentedView.isBeingDismissed() {
self.present(videoController, animated: true, completion: { _ in })
}
}
but no success ....does anybody have any idea how can this be achieve ???
or i'f I'm in a good track ??
Thanks a lot !!!
Upvotes: 1
Views: 723
Reputation: 135
You need to set displayMode
of GVRVideoView
TO kGVRWidgetDisplayModeFullscreenVR
OR kGVRWidgetDisplayModeFullscreen
here is code i use to display video in full screen
videoView.enableFullscreenButton = YES;
videoView.enableCardboardButton = YES;
videoView.displayMode = kGVRWidgetDisplayModeFullscreenVR;
[videoView play];
Upvotes: 0