Skip to content

Commit

Permalink
Use HTML5 video element instead of QuickTime to play h.264 YouTube fi…
Browse files Browse the repository at this point in the history
…lms.

Embedding QuickTime player in a web page results in ugly element overlaps
when z-indexes are involved: Breakage we can avoid if we use the <video>
element. Besides, this is the way of the future (-:

This change requires a recent WebKit (Tested in Safari 4).
  • Loading branch information
antifuchs committed Aug 14, 2009
1 parent 6370e2f commit 66fd859
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions Plugin/Plugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -1271,18 +1271,21 @@ - (void) _convertElementForMP4: (DOMElement*) element
}

[ element setAttribute: @"src" value: src ];
[ element setAttribute: @"type" value: @"video/mp4" ];
[ element setAttribute: @"scale" value: @"aspect" ];
[ element setAttribute: @"autoplay" value: @"true" ];
[ element setAttribute: @"cache" value: @"false" ];

if( ! [ element hasAttribute: @"width" ] )
[ element setAttribute: @"autobuffer" value:@"autobuffer"];
[ element setAttribute: @"autoplay" value:@"autoplay"];
[ element setAttribute: @"controls" value:@"controls"];

DOMElement* container = [self container];

if( [ container hasAttribute: @"width" ] )
[ element setAttribute: @"width" value:[ container getAttribute:@"width"]];
else
[ element setAttribute: @"width" value: @"640" ];

if( ! [ element hasAttribute: @"height" ] )
if( [ container hasAttribute: @"height" ] )
[ element setAttribute: @"height" value:[ container getAttribute:@"height"]];
else
[ element setAttribute: @"height" value: @"500" ];

[ element setAttribute: @"flashvars" value: nil ];
}

- (void) _convertToMP4Container
Expand All @@ -1296,7 +1299,7 @@ - (void) _convertToMP4Container

- (void) _convertToMP4ContainerAfterDelay
{
DOMElement* newElement = (DOMElement*) [ [self container] cloneNode: NO ];
DOMElement* newElement = [[[self container] ownerDocument] createElement:@"video"];

[ self _convertElementForMP4: newElement ];

Expand Down

0 comments on commit 66fd859

Please sign in to comment.