Closed uranpro closed 8 years ago
Thanks for the bug report. This is a known issue that we're working on.
You can put the GVRVideoView Object in a singleton Class then you can play multiple videos without issues. The following solutions in swift is working for me
class GVFix{
static var sharedInstance = GVRVideoView()
private init(){}
}
class GoogleViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
GVFix.sharedInstance.resume()
GVFix.sharedInstance.frame = CGRectMake(0, 0, view.frame.width, view.frame.height)
GVFix.sharedInstance.enableCardboardButton = false
GVFix.sharedInstance.enableFullscreenButton = false
GVFix.sharedInstance.loadFromUrl("https://xxxxxxx/xxxx.mp4", ofType: GVRVideoType.Mono)
GVFix.sharedInstance.displayMode = GVRWidgetDisplayMode.FullscreenVR
GVFix.sharedInstance.delegate = self
view.addSubview(GVFix.sharedInstance)
}
override func viewDidDisappear(animated: Bool) {
super.viewDidDisappear(animated)
GVFix.sharedInstance.stop()
GVFix.sharedInstance.removeFromSuperview()
}
}
@rainerjungwirth good shout, this works well for now at least to prevent the crashing I was experiencing time and again....
Actually, as a follow up, the Singleton approach helps resolve some memory issues (I still get a warning) when rendering the video in the non-cardboard view, but when I switch to cardboard fullscreen mode, my app crashes (on device) with error:
Message from debugger: Terminated due to memory issue
Edit: just realised I'm running 0.8.5
of GVRSDK, updating pod now to test with any later version...
Edit: OK, now running 0.9.0
and confirm same issue when loading Cardboard View.
My sample video is ~880MB in stereo format Also verified same result with ~220MB in mono format
Blush. I killed some UIImage animations and haven't had an issue with the VRView player since.
Well, glad you got it fixed :)
@nathanmartz it fix only cardboard issue! But not huge lags and memory leaks
Sorry about that. I think at least the leaks will be fixed in our next update. We haven't had as much reproducing the lags.
Please try the latest GVRSDK 1.0.1.
https://github.com/CocoaPods/Specs/blob/master/Specs/GVRSDK/1.0.1/GVRSDK.podspec.json
Huge lags
When I play ~5 videos in 1 GVRVideoView its start lagging very hard.
Cardboard not working
Trying to resolve lags(1) I start creating videoView for each URL. Cardboard working fine only first time, next tries will show black screen. I think there is a memory leaks...
Memory leaks in 0.9.0
When I saw cardboard problems(2), I checked GVRVideoView for memory leaks:
1) create GVRVideoView and load some video from URL 2) wait until video starts 3) remove GVRVideoView from superview 4) GVRVideoView is not deallocated (can see in profiler Instruments->Leaks)