Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Green screen when allocating/deallocating a video view at the same time. #183

Closed
jclou opened this issue Dec 29, 2016 · 15 comments
Closed
Labels

Comments

@jclou
Copy link

jclou commented Dec 29, 2016

In my code I am playing a video with a GVRVideoView and at a certain time I want to stop and play a different video. The second video always shows a green screen, but the audio plays properly.

In this contrived example, the first video view doesn't need even need to be loaded with a video or added to any view to break the second video. If I wait until -dealloc is called on the first video view before creating the second, then everything works as expected.

- (void)viewDidLoad {
    [super viewDidLoad];
    
    // Commenting out this line fixes the video
    self.videoView = [GVRVideoView new];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        self.videoView = [[GVRVideoView alloc] initWithFrame:CGRectMake(0, 100, 192, 108)];
        [self.videoView loadFromUrl:[NSURL URLWithString:@"https://pannellum.org/images/video/jfk.mp4"]];
        self.videoView.delegate = self;
        [self.view addSubview:self.videoView];
    });
}

- (void)widgetView:(GVRWidgetView *)widgetView didLoadContent:(id)content {
    [(GVRVideoView *)widgetView play];
}

I am getting this behavior on both 1.0.1 and 1.10.0. Versions 0.8.x and 0.9.x seem to work as expected.

@rr-hung-nguyen
Copy link

rr-hung-nguyen commented Feb 6, 2017

In version 1.20.0 I got the same problem even though it seem to be fixed when I read version description. It was playing properly in the first time, but when i open the other video (or the same video), the green screen will be shown. Please check the issue or point me what thing I was wrong. Thank you.

Could not create Texture, err = -6683

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    _videoView = [NCBVRVideoViewSingleton sharedInstance]; // Static GVRVideoView

    _videoView.frame = self.view.bounds;
    _videoView.delegate = self;
    _videoView.enableFullscreenButton = NO;
    _videoView.enableCardboardButton = YES;
    _videoView.enableTouchTracking = YES;
    [self.view addSubview:_videoView];
    [_videoView loadFromUrl:[NSURL URLWithString:self.videoPath] ofType:kGVRVideoTypeMono];
}

NCBVRVideoViewSingleton sharedInstance:

+ (GVRVideoView*)sharedInstance {
    static GVRVideoView *videoView;
    if (!videoView) {
        videoView = [[GVRVideoView alloc] init];
        videoView.enableFullscreenButton = YES;
        videoView.enableCardboardButton = YES;
        videoView.enableTouchTracking = YES;
    }
    return videoView;
}

screen shot 2017-02-06 at 1 46 21 pm

@jclou
Copy link
Author

jclou commented Feb 8, 2017

I am also still getting this issue on version 1.20.0

@sanjayc77
Copy link

Does this happen even when you don't reuse the same GVRVideoView instance (don't use a singleton)?

@jclou
Copy link
Author

jclou commented Feb 8, 2017

In my case, I have a ClassA instance that has a GVRVideoView. At some point, I get rid of my instance of ClassA and replace it with a new instance that has its own different GVRVideoView. The new GVR player gets stuck with a green screen. You can reproduce it with the code blow:

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.videoView = [[GVRVideoView alloc] initWithFrame:CGRectMake(0, 100, 192, 108)];
    self.videoView.delegate = self;
    [self.videoView loadFromUrl:[NSURL URLWithString:@"https://pannellum.org/images/video/jfk.mp4"]];
    [self.view addSubview:self.videoView];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [self.videoView pause];
        [self.videoView removeFromSuperview];
        self.videoView = nil;
        
        self.videoView2 = [[GVRVideoView alloc] initWithFrame:CGRectMake(0, 300, 192, 108)];
        self.videoView2.delegate = self;
        [self.videoView2 loadFromUrl:[NSURL URLWithString:@"https://pannellum.org/images/video/jfk.mp4"]];
        [self.view addSubview:self.videoView2];
    });

- (void)widgetView:(GVRWidgetView *)widgetView didLoadContent:(id)content {
    [(GVRVideoView *)widgetView play];
}

Also when creating two GVRVideoViews at the same time, the first one gets stuck with a green screen.

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.videoView = [[GVRVideoView alloc] initWithFrame:CGRectMake(0, 100, 192, 108)];
    self.videoView.delegate = self;
    [self.videoView loadFromUrl:[NSURL URLWithString:@"http://d8d913s460fub.cloudfront.net/krpanocloud/video/airpano/video-1920x960a.mp4"]];
    [self.view addSubview:self.videoView];
    
    self.videoView2 = [[GVRVideoView alloc] initWithFrame:CGRectMake(0, 300, 192, 108)];
    self.videoView2.delegate = self;
    [self.videoView2 loadFromUrl:[NSURL URLWithString:@"https://pannellum.org/images/video/jfk.mp4"]];
    [self.view addSubview:self.videoView2];
}

@Sourcebits-Ravik
Copy link

I am facing black screen instead of green screen after updating from 1.10 to 1.20.0.
screen shot 2017-02-11 at 10 43 25 pm

@rr-hung-nguyen
Copy link

@sanjayc77 It's ok if I create new instance instead of using singleton.

@tibewww
Copy link

tibewww commented Mar 9, 2017

Anybody managed to sold that ?

@rr-hung-nguyen
Copy link

rr-hung-nguyen commented Mar 14, 2017

@tibewww It was still showing green screen if you use the same GVRVideoView instance for loading videos in many times.

@tibewww
Copy link

tibewww commented Mar 15, 2017

ok, so we don't have any solution ?

@deltatre-team-mobile
Copy link

issue still present on 1.30.0 despite the release note claims to have fixed it

@tibewww
Copy link

tibewww commented Mar 16, 2017

is there a way to load a new GVRVideoView eachtime you trigger the video by click button do you think ?

@sanjayc77
Copy link

This issue was, inadvertently, not fixed in 1.30. Sorry about the confusion. We will have this fix in the next release.

@markusekblad
Copy link

@sanjayc77 When might that be available?

@tibewww
Copy link

tibewww commented Apr 5, 2017

any news about the next release date of the next version :( ?

@fredsa fredsa added the bug label Sep 29, 2017
@sanjayc77
Copy link

GVRVideoView is now deprecated. Switch to GVRKit. GVRKit provides fine grained control over AVPlayer playback and its rendering. See the updated VideoWidgetDemo sample.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

8 participants