Advertisement
undeadhip

Untitled

Apr 7th, 2015
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (id) initWithContentPath: (NSString *) path
  2.                 parameters: (NSDictionary *) parameters
  3. {
  4.     NSAssert(path.length > 0, @"empty path");
  5.    
  6.     self = [super initWithNibName:nil bundle:nil];
  7.     if (self) {
  8.        
  9.         _moviePosition = 0;
  10. //        self.wantsFullScreenLayout = YES;
  11.  
  12.         _parameters = parameters;
  13.        
  14.         __weak KxMovieViewController *weakSelf = self;
  15.        
  16.         KxMovieDecoder *decoder = [[KxMovieDecoder alloc] init];
  17.        
  18.         decoder.interruptCallback = ^BOOL(){
  19.            
  20.             __strong KxMovieViewController *strongSelf = weakSelf;
  21.             return strongSelf ? [strongSelf interruptDecoder] : YES;
  22.         };
  23.        
  24.         dispatch_async(dispatch_get_global_queue(0, 0), ^{
  25.    
  26.             NSError *error = nil;
  27.             [decoder openFile:path error:&error];
  28.                        
  29.             __strong KxMovieViewController *strongSelf = weakSelf;
  30.             if (strongSelf) {
  31.                
  32.                 dispatch_sync(dispatch_get_main_queue(), ^{
  33.                    
  34.                     [strongSelf setMovieDecoder:decoder withError:error];                    
  35.                 });
  36.             }
  37.         });
  38.     }
  39.     return self;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement