From db45b5d814d3ecacf7bf84fc09e5e21f685fee53 Mon Sep 17 00:00:00 2001 From: David Robles Date: Thu, 17 Nov 2016 10:26:12 -0800 Subject: [PATCH] =?UTF-8?q?Update=20sample=20video=20project=20to=20allow?= =?UTF-8?q?=20for=20testing=20video=E2=80=99s=20placeholder=20image=20isn?= =?UTF-8?q?=E2=80=99t=20prematurely=20cleared.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/Videos/Sample/ViewController.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/Videos/Sample/ViewController.m b/examples/Videos/Sample/ViewController.m index b372b41786..6b2bbc33fb 100644 --- a/examples/Videos/Sample/ViewController.m +++ b/examples/Videos/Sample/ViewController.m @@ -69,6 +69,12 @@ return [ASAbsoluteLayoutSpec absoluteLayoutSpecWithChildren:@[guitarVideoNode, nicCageVideoNode, simonVideoNode, hlsVideoNode]]; }; + // Delay setting video asset for testing that the transition between the placeholder and setting/playing the asset is seamless. + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + hlsVideoNode.asset = [AVAsset assetWithURL:[NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8"]]; + [hlsVideoNode play]; + }); + [self.view addSubnode:_rootNode]; } @@ -124,9 +130,8 @@ ASVideoNode *hlsVideoNode = [[ASVideoNode alloc] init]; hlsVideoNode.delegate = self; - hlsVideoNode.asset = [AVAsset assetWithURL:[NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8"]]; hlsVideoNode.gravity = AVLayerVideoGravityResize; - hlsVideoNode.backgroundColor = [UIColor lightGrayColor]; + hlsVideoNode.backgroundColor = [UIColor redColor]; // Should not be seen after placeholder image is loaded hlsVideoNode.shouldAutorepeat = YES; hlsVideoNode.shouldAutoplay = YES; hlsVideoNode.muted = YES;