dwinnbrown dwinnbrown - 1 month ago 17x
Objective-C Question

Google VR View - Setting type of video

So I am trying to use Google's VR SDK to play a video in my app however am having a few issues. Despite the documentation, it appears that we can no longer set the type of the video so I am getting the video displaying like this: enter image description here

I can't move it around at all like I should be able to. Also the parameters for full screen mode doesn't appear to be working. Does anyone know how this can be fixed? This is the code I am using:

#import <UIKit/UIKit.h>
#import "NewViewController.h"
#import "GVRVideoView.h"

@interface NewViewController ()
@property (nonatomic) IBOutlet GVRVideoView *viewView;


@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
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];



The method loadFromUrl: without a type passed defaults to kGVRVideoTypeMono.

The method signatures should answer your question:

 * Load a local or remote video from a url and start playing.
 * The video is assumed to be of type |kGVRVideoTypeMono|.
- (void)loadFromUrl:(NSURL*)videoUrl;

 * Load a local or remote video from a url and start playing.
 * The video type is set by |videoType|.
- (void)loadFromUrl:(NSURL*)videoUrl ofType:(GVRVideoType)videoType;