incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From becka...@apache.org
Subject [2/2] git commit: fixes CB-42 MediaPlaybackRequiresUserAction can now be set to NO
Date Fri, 20 Jan 2012 21:29:59 GMT
fixes CB-42 MediaPlaybackRequiresUserAction can now be set to NO

Previous code assumed default value of NO which was incorrect and
there was not way to set the value to NO.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/f60c315c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/f60c315c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/f60c315c

Branch: refs/heads/master
Commit: f60c315c262439f4acea74ca07b81933fe0a0b2a
Parents: d56c7cc
Author: Becky Gibson <becka11y@apache.org>
Authored: Fri Jan 20 16:19:35 2012 -0500
Committer: Becky Gibson <becka11y@apache.org>
Committed: Fri Jan 20 16:19:35 2012 -0500

----------------------------------------------------------------------
 PhoneGapLib/Classes/PGViewController.m |   20 ++++++++++++--------
 PhoneGapLib/Classes/PhoneGapDelegate.m |   24 ++++++++++++++----------
 2 files changed, 26 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/f60c315c/PhoneGapLib/Classes/PGViewController.m
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/PGViewController.m b/PhoneGapLib/Classes/PGViewController.m
index 1cb2afe..44abb89 100644
--- a/PhoneGapLib/Classes/PGViewController.m
+++ b/PhoneGapLib/Classes/PGViewController.m
@@ -123,25 +123,29 @@
     NSNumber* enableLocation       = [settings objectForKey:@"EnableLocation"];
     NSString* enableViewportScale  = [settings objectForKey:@"EnableViewportScale"];
     NSNumber* allowInlineMediaPlayback = [settings objectForKey:@"AllowInlineMediaPlayback"];
-    NSNumber* mediaPlaybackRequiresUserAction = [settings objectForKey:@"MediaPlaybackRequiresUserAction"];
+    BOOL mediaPlaybackRequiresUserAction = YES;  // default value
+    if ([settings objectForKey:@"MediaPlaybackRequiresUserAction"]) {
+        mediaPlaybackRequiresUserAction = [(NSNumber*)[settings objectForKey:@"MediaPlaybackRequiresUserAction"]
boolValue];
+    }
     
     self.webView.scalesPageToFit = [enableViewportScale boolValue];
     
     /*
      * 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;
+    
+    if ([enableLocation boolValue]) {
+        [[self.commandDelegate getCommandInstance:@"com.phonegap.geolocation"] startLocation:nil
withDict:nil];
     }
     
     /*
      * This is for iOS 4.x, where you can allow inline <video> and <audio>, and
also autoplay them
      */
-    if ([enableLocation boolValue]) {
-        [[self.commandDelegate getCommandInstance:@"com.phonegap.geolocation"] startLocation:nil
withDict:nil];
+    if ([allowInlineMediaPlayback boolValue] && [self.webView respondsToSelector:@selector(allowsInlineMediaPlayback)])
{
+        self.webView.allowsInlineMediaPlayback = YES;
+    }
+    if (mediaPlaybackRequiresUserAction == NO && [self.webView respondsToSelector:@selector(mediaPlaybackRequiresUserAction)])
{
+        self.webView.mediaPlaybackRequiresUserAction = NO;
     }
     
     ///////////////////

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/f60c315c/PhoneGapLib/Classes/PhoneGapDelegate.m
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/PhoneGapDelegate.m b/PhoneGapLib/Classes/PhoneGapDelegate.m
index cdb4925..b259242 100755
--- a/PhoneGapLib/Classes/PhoneGapDelegate.m
+++ b/PhoneGapLib/Classes/PhoneGapDelegate.m
@@ -406,7 +406,11 @@ BOOL gSplashScreenShown_ = NO;
     NSNumber *enableLocation       = [self.settings objectForKey:@"EnableLocation"];
     NSString *enableViewportScale  = [self.settings objectForKey:@"EnableViewportScale"];
     NSNumber *allowInlineMediaPlayback = [self.settings objectForKey:@"AllowInlineMediaPlayback"];
-    NSNumber *mediaPlaybackRequiresUserAction = [self.settings objectForKey:@"MediaPlaybackRequiresUserAction"];
+    BOOL mediaPlaybackRequiresUserAction = YES;  // default value
+    if ([self.settings objectForKey:@"MediaPlaybackRequiresUserAction"]) {
+        mediaPlaybackRequiresUserAction = [(NSNumber*)[self.settings objectForKey:@"MediaPlaybackRequiresUserAction"]
boolValue];
+    }
+    
     
     // Set the supported orientations for rotation. If number of items in the array is >
1, autorotate is supported
     viewController.supportedOrientations = supportedOrientations;
@@ -457,20 +461,20 @@ BOOL gSplashScreenShown_ = NO;
     /*
      * 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;
+    
+    if ([enableLocation boolValue]) {
+        [[self getCommandInstance:@"com.phonegap.geolocation"] startLocation:nil withDict:nil];
     }
-
+    
     /*
      * 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];
+    if ([allowInlineMediaPlayback boolValue] && [self.webView respondsToSelector:@selector(allowsInlineMediaPlayback)])
{
+        self.webView.allowsInlineMediaPlayback = YES;
+    }
+    if (mediaPlaybackRequiresUserAction == NO && [self.webView respondsToSelector:@selector(mediaPlaybackRequiresUserAction)])
{
+        self.webView.mediaPlaybackRequiresUserAction = NO;
     }
-    
 
     self.webView.delegate = self;
 


Mime
View raw message