-
-
Save BCdmlap/3132515 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)setupSetVideoListener | |
{ | |
[emitter on:BCEventSetVideo doChain:^(BCEvent *setVideoEvent, BCEventEmitterChain *chain){ | |
BCVideo *video = [setVideoEvent.details objectForKey:@"video"]; | |
[chain abortOn:BCEventSetVideo]; | |
[chain emit:BCEventShouldSetVideo]; | |
[chain thenDo:^(BCEvent *shouldSetVideoEvent){ | |
if (shouldSetVideoEvent.defaultPrevented) { | |
[chain emit:BCEventCancelledSetVideo parentEvent:setVideoEvent]; | |
[chain abort]; | |
} | |
}]; | |
[chain emit:BCEventWillSetVideo parentEvent:setVideoEvent]; | |
[chain emit:BCEventSetRendition withDetails: | |
[NSDictionary dictionaryWithObject:rendition forKey:@"rendition"]]; | |
[chain emit:BCEventSetVideoStill withDetails: | |
[NSDictionary dictionaryWithObject:videoStill forKey:@"videoStill"]]; | |
[chain waitForBoth:BCEventDidSetRendition and:BCEventDidSetVideoStill]; | |
[chain thenDo:^{ | |
self.video = video; | |
[chain emit:BCEventDidSetVideo parentEvent:setVideoEvent]; | |
}]; | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment