@@ -79,6 +79,7 @@ - (void) _loadContentForWindow: (NSNotification*) notification;
79
79
80
80
- (NSDictionary *) _flashVarDictionary : (NSString *) flashvarString ;
81
81
- (NSDictionary *) _flashVarDictionaryFromYouTubePageHTML : (NSString *) youTubePageHTML ;
82
+ - (void )_didRetrieveEmbeddedPlayerFlashVars : (NSDictionary *)flashVars ;
82
83
- (void )_getEmbeddedPlayerFlashVarsAndCheckForVariantsWithVideoId : (NSString *)videoId ;
83
84
- (NSString *) flashvarWithName : (NSString *) argName ;
84
85
- (void ) _checkForH264VideoVariants ;
@@ -1160,7 +1161,7 @@ - (NSDictionary*) _flashVarDictionaryFromYouTubePageHTML: (NSString*) youTubePag
1160
1161
1161
1162
- (NSString *) flashvarWithName: (NSString *) argName
1162
1163
{
1163
- return [ _flashVars objectForKey: argName ];
1164
+ return [[[ _flashVars objectForKey: argName ] retain ] autorelease ];
1164
1165
}
1165
1166
1166
1167
/* - (NSString*) _videoId
@@ -1468,6 +1469,18 @@ - (IBAction)openFullscreenInQTPlayer:(id)sender;
1468
1469
[openInQTPlayerScript release ];
1469
1470
}
1470
1471
1472
+ - (void )_didRetrieveEmbeddedPlayerFlashVars: (NSDictionary *)flashVars
1473
+ {
1474
+ if (flashVars)
1475
+ {
1476
+ _flashVars = [flashVars retain ];
1477
+ NSString *videoId = [self flashvarWithName: @" video_id" ];
1478
+ [self setVideoId: videoId];
1479
+ }
1480
+
1481
+ [self _checkForH264VideoVariants ];
1482
+ }
1483
+
1471
1484
- (void )_retrieveEmbeddedPlayerFlashVarsAndCheckForVariantsWithVideoId: (NSString *)videoId
1472
1485
{
1473
1486
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc ] init ];
@@ -1478,13 +1491,13 @@ - (void)_retrieveEmbeddedPlayerFlashVarsAndCheckForVariantsWithVideoId:(NSString
1478
1491
NSString *pageSourceString = [NSString stringWithContentsOfURL: YouTubePageURL
1479
1492
usedEncoding: nil
1480
1493
error: &pageSourceError];
1481
- if (! pageSourceError) {
1482
- _flashVars = [[ self _flashVarDictionaryFromYouTubePageHTML: pageSourceString] retain ];
1483
- _videoId = [self flashvarWithName: @" video_id " ];
1494
+ NSDictionary *flashVars = nil ;
1495
+ if (pageSourceString && !pageSourceError) {
1496
+ flashVars = [self _flashVarDictionaryFromYouTubePageHTML: pageSourceString ];
1484
1497
}
1485
1498
1486
- [self performSelectorOnMainThread: @selector (_checkForH264VideoVariants )
1487
- withObject: nil
1499
+ [self performSelectorOnMainThread: @selector (_didRetrieveEmbeddedPlayerFlashVars: )
1500
+ withObject: flashVars
1488
1501
waitUntilDone: NO ];
1489
1502
1490
1503
[pool drain ];
@@ -1673,7 +1686,7 @@ - (void)setSrc:(NSString *)newValue
1673
1686
1674
1687
- (NSString *)videoId
1675
1688
{
1676
- return _videoId;
1689
+ return [[ _videoId retain ] autorelease ] ;
1677
1690
}
1678
1691
- (void )setVideoId: (NSString *)newValue
1679
1692
{
0 commit comments