Skip to content

Commit

Permalink
Added 'Play Fullscreen in QuickTime Player' option for H.264 YouTube …
Browse files Browse the repository at this point in the history
…videos; this should be modified to be an option for all Flash on Snowy Leopard since its QuickTime natively supports playing Flash files
  • Loading branch information
Simone Manganelli authored and Simone Manganelli committed Jun 26, 2009
1 parent e379669 commit 27dd7e5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Plugin/Plugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,11 @@ - (NSMenu*) menuForEvent: (NSEvent*) event
action: @selector( loadH264: ) keyEquivalent: @"" atIndex: 1];
[[self menu] insertItemWithTitle: NSLocalizedString( @"Download H.264", "Download H.264 menu item" )
action: @selector( downloadH264: ) keyEquivalent: @"" atIndex: 2];
[[self menu] insertItemWithTitle: NSLocalizedString( @"Play Fullscreen in QuickTime Player", "Open Fullscreen in QT Player menu item" )
action: @selector( openFullscreenInQTPlayer: ) keyEquivalent: @"" atIndex: 3];
[[[self menu] itemAtIndex: 1] setTarget: self];
[[[self menu] itemAtIndex: 2] setTarget: self];
[[[self menu] itemAtIndex: 3] setTarget: self];
} else if (_fromYouTube) {
// has no H.264 version but is from YouTube; it's an embedded view!

Expand Down Expand Up @@ -1075,6 +1078,22 @@ - (IBAction)loadYouTubePage:(id)sender
launchIdentifiers:nil];
}

- (IBAction)openFullscreenInQTPlayer:(id)sender;
{
NSString* video_id = [self videoId];
NSString* video_hash = [ self _videoHash ];

NSString* src = [ NSString stringWithFormat: @"http://www.youtube.com/get_video?fmt=18&video_id=%@&t=%@",
video_id, video_hash ];

NSString *scriptSource = [NSString stringWithFormat:
@"tell application \"QuickTime Player\"\nactivate\ngetURL \"%@\"\nrepeat while (display state of front document is not presentation)\ndelay 1\npresent front document scale screen\nend repeat\nrepeat while (playing of front document is false)\ndelay 1\nplay front document\nend repeat\nend tell",src];
NSLog(@"%@",scriptSource);
NSAppleScript *openInQTPlayerScript = [[NSAppleScript alloc] initWithSource:scriptSource];
[openInQTPlayerScript executeAndReturnError:nil];
[openInQTPlayerScript release];
}


#pragma mark -
#pragma mark DOM Conversion
Expand Down

0 comments on commit 27dd7e5

Please sign in to comment.