Skip to content

Commit

Permalink
Fixed #255 ability to play inline videos
Browse files Browse the repository at this point in the history
  • Loading branch information
shazron committed Sep 30, 2011
1 parent 8821a61 commit 0f5c44a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions PhoneGap-based Application/PhoneGap.plist
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
<true/> <true/>
<key>ShowSplashScreenSpinner</key> <key>ShowSplashScreenSpinner</key>
<true/> <true/>
<key>MediaPlaybackRequiresUserAction</key>
<false/>
<key>AllowInlineMediaPlayback</key>
<false/>
<key>ExternalHosts</key> <key>ExternalHosts</key>
<array/> <array/>
<key>Plugins</key> <key>Plugins</key>
Expand Down
13 changes: 12 additions & 1 deletion PhoneGapLib/Classes/PhoneGapDelegate.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -389,7 +389,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(


NSNumber *enableLocation = [self.settings objectForKey:@"EnableLocation"]; NSNumber *enableLocation = [self.settings objectForKey:@"EnableLocation"];
NSString *enableViewportScale = [self.settings objectForKey:@"EnableViewportScale"]; NSString *enableViewportScale = [self.settings objectForKey:@"EnableViewportScale"];

NSNumber *allowInlineMediaPlayback = [self.settings objectForKey:@"AllowInlineMediaPlayback"];
NSNumber *mediaPlaybackRequiresUserAction = [self.settings objectForKey:@"MediaPlaybackRequiresUserAction"];


// The first item in the supportedOrientations array is the start orientation (guaranteed to be at least Portrait) // The first item in the supportedOrientations array is the start orientation (guaranteed to be at least Portrait)
[[UIApplication sharedApplication] setStatusBarOrientation:[[supportedOrientations objectAtIndex:0] intValue]]; [[UIApplication sharedApplication] setStatusBarOrientation:[[supportedOrientations objectAtIndex:0] intValue]];
Expand Down Expand Up @@ -418,6 +419,16 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
/* /*
* Fire up the GPS Service right away as it takes a moment for data to come back. * Fire up the GPS Service right away as it takes a moment for data to come back.
*/ */
if ([allowInlineMediaPlayback boolValue] && [self.webView respondsToSelector:@selector(allowsInlineMediaPlayback)]) {
self.webView.allowsInlineMediaPlayback = YES;
}
if ([mediaPlaybackRequiresUserAction boolValue] && [self.webView respondsToSelector:@selector(mediaPlaybackRequiresUserAction)]) {
self.webView.mediaPlaybackRequiresUserAction = YES;
}

/*
* This is for iOS 4.x, where you can allow inline <video> and <audio>, and also autoplay them
*/
if ([enableLocation boolValue]) { if ([enableLocation boolValue]) {
[[self getCommandInstance:@"com.phonegap.geolocation"] startLocation:nil withDict:nil]; [[self getCommandInstance:@"com.phonegap.geolocation"] startLocation:nil withDict:nil];
} }
Expand Down

0 comments on commit 0f5c44a

Please sign in to comment.