You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/01/07 22:58:29 UTC

[GitHub] [cordova-ios] josiaho opened a new issue #1055: Config.xml prefs do not apply to Secondary webview (Airplay)?

josiaho opened a new issue #1055:
URL: https://github.com/apache/cordova-ios/issues/1055


   # Bug Report
   
   ## Problem
   I want to play/autoplay an inline video on a secondary screen (Airplay).
   Test Project: [Looper.zip](https://github.com/apache/cordova-ios/files/5784267/Looper.zip)
   
   ### What is expected to happen?
   Once the extended screen (airplay) launches, the inline video should load and autoplay.
   
   ### What does actually happen?
   Once the extended screen (airplay) launches, the inline video appears to load, but does not autoplay.
   
   ## Information
   My config.xml contains the following preferences:
   `<preference name="AllowInlineMediaPlayback" value="true" />`
   `<preference name="MediaTypesRequiringUserActionForPlayback" value="none" />`
   And my external page contains this tag:
   `<video src="img/fireandiceocean.mp4" preload autoplay playsinline loop />`
   
   _The preferences do not appear to apply to the secondary webview._
   
   I've modified the [cordova-plugin-wkwebview-external-screen](https://github.com/josiaho/cordova-plugin-wkwebview-external-screen) plugin in [WKWebViewExternalScreen.m](https://github.com/josiaho/cordova-plugin-wkwebview-external-screen/blob/master/src/ios/WKWebViewExternalScreen.m) with the following with no avail:
   
   ```
   - (WKWebView*)getWebView {
       if (!self.externalWebView) {
           UIScreen* externalScreen = [[UIScreen screens] objectAtIndex: 1];
           CGRect screenBounds = externalScreen.bounds;
   
           self.externalWebView = [[WKWebView alloc] initWithFrame: screenBounds configuration: [[WKWebViewConfiguration alloc] init]];
   
           // I ADDED THESE TWO LINES
           self.externalWebView.configuration.allowsInlineMediaPlayback = YES;// Updated 'true' to 'YES'
           self.externalWebView.configuration.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone;
   
           self.externalWindow = [[UIWindow alloc] initWithFrame: screenBounds];
   
           self.externalWindow.screen = externalScreen;
           self.externalWindow.clipsToBounds = YES;
           [self.externalWindow addSubview:self.externalWebView];
           [self.externalWindow makeKeyAndVisible];
           self.externalWindow.hidden = NO;
       }
       return self.externalWebView;
   }
   ```
   
   Any thoughts?
   
   ### Environment, Platform, Device
   iPhone 7, iPad Mini 2, iPad Air 2, iPod touch gen 7, Xcode Simulators - all on iOS 14.2
   
   
   
   ### Version information
   Cordova: CLI 10.0.0, iOS 6.1.1
   macOS 11.1 on an intel Retina iMac and M1 MacBook Air
   Xcode 12.3
   
   
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [ x] I searched for existing GitHub issues
   - [x ] I updated all Cordova tooling to most recent version
   - [x ] I included all the necessary information above
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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