Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio Capture - added support for iPhone 6 and iPhone 6 Plus microphone images #76

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions src/ios/CDVCapture.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Licensed to the Apache Software Foundation (ASF) under one
#import "CDVCapture.h"
#import "CDVFile.h"
#import <Cordova/CDVAvailability.h>
#import <Cordova/CDVAvailability.h>

#define kW3CMediaFormatHeight @"height"
#define kW3CMediaFormatWidth @"width"
Expand Down Expand Up @@ -620,6 +621,17 @@ - (void)loadView
if (isIphone5) {
microphoneResource = @"CDVCapture.bundle/microphone-568h";
}
// iPhone 6, iPhone 6s, iPhone 7: 375 × 667
BOOL isIphone6 = ([[UIScreen mainScreen] bounds].size.width == 667 && [[UIScreen mainScreen] bounds].size.height == 375) || ([[UIScreen mainScreen] bounds].size.height == 667 && [[UIScreen mainScreen] bounds].size.width == 375);
if (isIphone6) {
microphoneResource = @"CDVCapture.bundle/microphone-667h";
}

// iPhone 6 Plus, iPhone 6s Plus, iPhone 7 Plus: 414 × 736
BOOL isIphone6Plus = ([[UIScreen mainScreen] bounds].size.width == 736 && [[UIScreen mainScreen] bounds].size.height == 414) || ([[UIScreen mainScreen] bounds].size.height == 736 && [[UIScreen mainScreen] bounds].size.width == 414);
if (isIphone6Plus) {
microphoneResource = @"CDVCapture.bundle/microphone-736h";
}

NSBundle* cdvBundle = [NSBundle bundleForClass:[CDVCapture class]];
UIImage* microphone = [UIImage imageNamed:[self resolveImageResource:microphoneResource] inBundle:cdvBundle compatibleWithTraitCollection:nil];
Expand Down