因此,我嘗試使用Google的VR SDK在我的應用中播放視頻,但我遇到了一些問題。儘管有文檔,但看起來我們不能再設置視頻的類型,所以我得到的視頻顯示如下:谷歌VR視圖 - 視頻的設置類型
我不能像所有我應該能夠移動它。此外全屏模式的參數似乎沒有工作。有誰知道這可以解決嗎?這是我使用的代碼:
#import <UIKit/UIKit.h>
#import "NewViewController.h"
#import "GVRVideoView.h"
@interface NewViewController()
@property (nonatomic) IBOutlet GVRVideoView *viewView;
@end
@implementation NewViewController {
BOOL _isPaused;
}
- (instancetype)init {
self = [super initWithNibName:nil bundle:nil];
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
_viewView.enableFullscreenButton = YES;
_viewView.enableCardboardButton = YES;
_isPaused = true;
// Load the sample 360 video, which is of type stereo-over-under.
NSString *videoPath = [[NSBundle mainBundle] pathForResource:@"congo" ofType:@"mp4"];
[_viewView loadFromUrl:[[NSURL alloc] initFileURLWithPath:videoPath]];
}
#pragma mark - GVRVideoViewDelegate
- (void)widgetViewDidTap:(GVRWidgetView *)widgetView {
if (_isPaused) {
[_viewView resume];
} else {
[_viewView pause];
}
_isPaused = !_isPaused;
}
- (void)widgetView:(GVRWidgetView *)widgetView didLoadContent:(id)content {
NSLog(@"Finished loading video");
}
- (void)widgetView:(GVRWidgetView *)widgetView
didFailToLoadContent:(id)content
withErrorMessage:(NSString *)errorMessage {
NSLog(@"Failed to load video: %@", errorMessage);
}
- (void)videoView:(GVRVideoView*)videoView didUpdatePosition:(NSTimeInterval)position {
// Loop the video when it reaches the end.
if (position == videoView.duration) {
[videoView seekTo:0];
[videoView resume];
}
}
@end