cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject [11/43] ios commit: CB-7184 - Implement support for mediaPlaybackAllowsAirPlay in UIWebView and WKWebView
Date Sat, 07 Mar 2015 00:18:24 GMT
CB-7184 - Implement support for mediaPlaybackAllowsAirPlay in UIWebView and WKWebView

plus config cleanup.


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

Branch: refs/heads/4.0.x
Commit: b3fbd850672a2cccb5163bca3720d618118d72bd
Parents: e22c8fb
Author: Shazron Abdullah <shazron@apache.org>
Authored: Mon Jul 21 14:48:51 2014 -0700
Committer: Shazron Abdullah <shazron@apache.org>
Committed: Fri Oct 31 15:37:43 2014 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVWebViewPreferences.m | 42 +++++++++++++++++--------
 1 file changed, 29 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/b3fbd850/CordovaLib/Classes/CDVWebViewPreferences.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWebViewPreferences.m b/CordovaLib/Classes/CDVWebViewPreferences.m
index f1cb48f..eb55c9d 100644
--- a/CordovaLib/Classes/CDVWebViewPreferences.m
+++ b/CordovaLib/Classes/CDVWebViewPreferences.m
@@ -72,25 +72,34 @@
 
 - (void)updateUIWebView:(UIWebView*)theWebView settings:(NSDictionary*)settings
 {
-    NSString* enableViewportScale = [self cordovaSettings:settings forKey:@"EnableViewportScale"];
-    NSNumber* allowInlineMediaPlayback = [self cordovaSettings:settings forKey:@"AllowInlineMediaPlayback"];
-    BOOL mediaPlaybackRequiresUserAction = YES;  // default value
+    BOOL scalesPageToFit = NO; // default
+    id prefObj = [self cordovaSettings:settings forKey:@"EnableViewportScale"];
 
-    if ([self cordovaSettings:settings forKey:@"MediaPlaybackRequiresUserAction"]) {
-        mediaPlaybackRequiresUserAction = [(NSNumber*)[self cordovaSettings:settings forKey:@"MediaPlaybackRequiresUserAction"]
boolValue];
+    if (prefObj != nil) {
+        scalesPageToFit = [(NSNumber*)prefObj boolValue];
     }
+    theWebView.scalesPageToFit = scalesPageToFit;
 
-    theWebView.scalesPageToFit = [enableViewportScale boolValue];
+    BOOL allowInlineMediaPlayback = NO; // default
+    prefObj = [self cordovaSettings:settings forKey:@"AllowInlineMediaPlayback"];
+    if (prefObj != nil) {
+        allowInlineMediaPlayback = [(NSNumber*)prefObj boolValue];
+    }
+    theWebView.allowsInlineMediaPlayback = allowInlineMediaPlayback;
 
-    /*
-     * This is for iOS 4.x, where you can allow inline <video> and <audio>, and
also autoplay them
-     */
-    if ([allowInlineMediaPlayback boolValue] && [theWebView respondsToSelector:@selector(allowsInlineMediaPlayback)])
{
-        theWebView.allowsInlineMediaPlayback = YES;
+    BOOL mediaPlaybackRequiresUserAction = YES;  // default
+    prefObj = [self cordovaSettings:settings forKey:@"MediaPlaybackRequiresUserAction"];
+    if (prefObj != nil) {
+        mediaPlaybackRequiresUserAction = [(NSNumber*)prefObj boolValue];
     }
-    if ((mediaPlaybackRequiresUserAction == NO) && [theWebView respondsToSelector:@selector(mediaPlaybackRequiresUserAction)])
{
-        theWebView.mediaPlaybackRequiresUserAction = NO;
+    theWebView.mediaPlaybackRequiresUserAction = mediaPlaybackRequiresUserAction;
+
+    BOOL mediaPlaybackAllowsAirPlay = YES;  // default
+    prefObj = [self cordovaSettings:settings forKey:@"MediaPlaybackAllowsAirPlay"];
+    if (prefObj != nil) {
+        mediaPlaybackAllowsAirPlay = [(NSNumber*)prefObj boolValue];
     }
+    theWebView.mediaPlaybackAllowsAirPlay = mediaPlaybackAllowsAirPlay;
 
     // By default, overscroll bouncing is allowed.
     // UIWebViewBounce has been renamed to DisallowOverscroll, but both are checked.
@@ -263,6 +272,13 @@
         }
         theWebView.configuration.suppressesIncrementalRendering = suppressesIncrementalRendering;
 
+        BOOL mediaPlaybackAllowsAirPlay = YES;  // default
+        prefObj = [self cordovaSettings:settings forKey:@"MediaPlaybackAllowsAirPlay"];
+        if (prefObj != nil) {
+            mediaPlaybackAllowsAirPlay = [(NSNumber*)prefObj boolValue];
+        }
+        theWebView.configuration.mediaPlaybackAllowsAirPlay = mediaPlaybackAllowsAirPlay;
+
         /*
         BOOL javaScriptEnabled = YES;  // default value
         if ([self cordovaSettings:settings forKey:@"JavaScriptEnabled"]) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message