Browse files

H.264 loading of embedded videos now works again; re-enabled video ta…

…g support for the correct WebKit versions now that it's fixed in nightlies again; added a preference key to disable video tag support entirely for testing purposes and in case the WebKit version number isn't granular enough

(cherry picked from commit 125ec1a)
  • Loading branch information...
1 parent c9e2bfa commit 1f9d11d007165bd70abd96d1ff2223c0db183345 @simX simX committed Sep 17, 2009
Showing with 34 additions and 4 deletions.
  1. +34 −4 Plugin/Plugin.m
View
38 Plugin/Plugin.m
@@ -54,6 +54,7 @@ of this software and associated documentation files (the "Software"), to deal
static NSString *sPluginEnabled = @"pluginEnabled";
static NSString *sApplicationWhitelist = @"applicationWhitelist";
static NSString *sDrawGearImageOnlyOnMouseOverHiddenPref = @"drawGearImageOnlyOnMouseOver";
+static NSString *sDisableVideoElement = @"disableVideoElement";
// Info.plist key for app developers
static NSString *sCTFOptOutKey = @"ClickToFlashOptOut";
@@ -1300,6 +1301,9 @@ - (BOOL) _useH264Version
- (BOOL)_isVideoElementAvailable
{
+ if ( [[CTFUserDefaultsController standardUserDefaults] boolForKey:sDisableVideoElement] )
+ return NO;
+
/* <video> element compatibility was added to WebKit in or shortly before version 525. */
NSBundle* webKitBundle;
@@ -1319,12 +1323,30 @@ - (BOOL)_isVideoElementAvailable
normalizedVersion = wkVersion;
// unfortunately, versions of WebKit above 531.5 also introduce a nasty
- // scrolling bug with video elements that cause them to be unviewable, so we'll
- // have to basically disable this support until this bug is fixed;
+ // scrolling bug with video elements that cause them to be unviewable;
+ // this bug was fixed shortly after being reported by @simX, so we can
+ // now re-enable it for correct WebKit versions
+ //
+ // this bug actually only affected certain machines that had graphics
+ // cards with a certain max texture size, and it was partially fixed, but
+ // still didn't work for MacBooks with embedded graphics, and we could
+ // detect that if we really wanted, but that would require importing
+ // the OpenGL framework, which we probably shouldn't do, so we'll just
+ // wholesale disable for certain WebKit versions
//
// https://bugs.webkit.org/show_bug.cgi?id=28705
- return ((normalizedVersion >= 525) && (normalizedVersion < 531.5));
+ if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5) {
+ // Snowy Leopard; this bug doesn't seem to be exhibited here
+ return (normalizedVersion >= 525);
+ } else {
+ // this bug was introduced in version 531.5, but has been fixed in
+ // 532 and above
+
+ return ((normalizedVersion >= 532) ||
+ ((normalizedVersion >= 525) && (normalizedVersion < 531.5))
+ );
+ }
}
return NO;
}
@@ -1347,7 +1369,15 @@ - (NSString*) _h264VersionUrl
- (void) _convertElementForMP4: (DOMElement*) element
{
- [ element setAttribute: @"src" value: [ self _h264VersionUrl ]];
+ // some tags (OBJECT) want a data attribute, and some want a src attribute
+ // for some reason, though, some cloned elements are not reporting themselves
+ // as OBJECT tags, even though they are; more investigation on this is needed,
+ // but for now, setting both the data and the src attribute corrects the problem
+ // (see bug #294)
+
+ [ element setAttribute: @"data" value: [ self _h264VersionUrl ]];
+ [ element setAttribute: @"src" value: [ self _h264VersionUrl ]];
+
[ element setAttribute: @"type" value: @"video/mp4" ];
[ element setAttribute: @"scale" value: @"aspect" ];
if (_youTubeAutoPlay) {

0 comments on commit 1f9d11d

Please sign in to comment.