Skip to content

Instantly share code, notes, and snippets.

@BCdmlap
Forked from bcjwilson/gist:3132449
Created July 17, 2012 22:16
Show Gist options
  • Save BCdmlap/3132515 to your computer and use it in GitHub Desktop.
Save BCdmlap/3132515 to your computer and use it in GitHub Desktop.
- (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