Last active
December 12, 2015 00:58
-
-
Save drart/4687770 to your computer and use it in GitHub Desktop.
Create a new C4Movie for every touch on screen. (To a maximum of 4 videos, as per hardware limitation)
This file contains 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
// | |
// C4WorkSpace.m | |
// Touch2Video | |
// | |
// Created by Adam Tindale on 2013-01-30. | |
// 2013 Adam Tindale. CC Attribution - http://creativecommons.org/licenses/by/3.0/ | |
// | |
#import "C4WorkSpace.h" | |
@implementation C4WorkSpace | |
{ | |
NSMutableArray * movies; | |
} | |
-(void)setup | |
{ | |
movies = [[NSMutableArray alloc] init]; | |
} | |
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event | |
{ | |
CGPoint pointOnScreen = [[touches anyObject] locationInView:self.view]; | |
C4Movie *player = [C4Movie movieNamed:@"inception.mov"]; | |
//[player seekToTime: player.duration * 0.9]; // doesn't work? | |
player.shouldAutoplay = YES; | |
player.loops = NO; | |
player.userInteractionEnabled = NO; | |
player.center = pointOnScreen; | |
[self.canvas addMovie:player]; | |
[self listenFor:@"reachedEnd" fromObject:player andRunMethod:@"blarg:"]; | |
[movies addObject:player]; | |
} | |
-(void)blarg: (NSNotification *)notification | |
{ | |
[[notification object] removeFromSuperview]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment