Skip to content

Commit db45b5d

Browse files
author
David Robles
committed
Update sample video project to allow for testing video’s placeholder image isn’t prematurely cleared.
1 parent 4ad8361 commit db45b5d

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

examples/Videos/Sample/ViewController.m

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ - (void)viewDidLoad
6969
return [ASAbsoluteLayoutSpec absoluteLayoutSpecWithChildren:@[guitarVideoNode, nicCageVideoNode, simonVideoNode, hlsVideoNode]];
7070
};
7171

72+
// Delay setting video asset for testing that the transition between the placeholder and setting/playing the asset is seamless.
73+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
74+
hlsVideoNode.asset = [AVAsset assetWithURL:[NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8"]];
75+
[hlsVideoNode play];
76+
});
77+
7278
[self.view addSubnode:_rootNode];
7379
}
7480

@@ -124,9 +130,8 @@ - (ASVideoNode *)hlsVideoNode;
124130
ASVideoNode *hlsVideoNode = [[ASVideoNode alloc] init];
125131

126132
hlsVideoNode.delegate = self;
127-
hlsVideoNode.asset = [AVAsset assetWithURL:[NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8"]];
128133
hlsVideoNode.gravity = AVLayerVideoGravityResize;
129-
hlsVideoNode.backgroundColor = [UIColor lightGrayColor];
134+
hlsVideoNode.backgroundColor = [UIColor redColor]; // Should not be seen after placeholder image is loaded
130135
hlsVideoNode.shouldAutorepeat = YES;
131136
hlsVideoNode.shouldAutoplay = YES;
132137
hlsVideoNode.muted = YES;

0 commit comments

Comments
 (0)