Permalink
Browse files

Fixed #255 ability to play inline videos

  • Loading branch information...
1 parent 8821a61 commit 0f5c44a4a55bc7d264426ca3398333401d498f26 @shazron shazron committed Sep 30, 2011
Showing with 16 additions and 1 deletion.
  1. +4 −0 PhoneGap-based Application/PhoneGap.plist
  2. +12 −1 PhoneGapLib/Classes/PhoneGapDelegate.m
@@ -16,6 +16,10 @@
<true/>
<key>ShowSplashScreenSpinner</key>
<true/>
+ <key>MediaPlaybackRequiresUserAction</key>
+ <false/>
+ <key>AllowInlineMediaPlayback</key>
+ <false/>
<key>ExternalHosts</key>
<array/>
<key>Plugins</key>
@@ -389,7 +389,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
NSNumber *enableLocation = [self.settings objectForKey:@"EnableLocation"];
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)
[[UIApplication sharedApplication] setStatusBarOrientation:[[supportedOrientations objectAtIndex:0] intValue]];
@@ -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.
*/
+ 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]) {
[[self getCommandInstance:@"com.phonegap.geolocation"] startLocation:nil withDict:nil];
}

0 comments on commit 0f5c44a

Please sign in to comment.