Skip to content

Commit

Permalink
Injecting Error #194
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyVerbruggen committed Mar 10, 2019
1 parent 1816d26 commit 933f597
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/barcodescanner.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ export class BarcodeScannerView extends BarcodeScannerBaseView {
super();
this._hasSupport = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo) !== null;
if (this._hasSupport) {
// play nice with others
AVAudioSession.sharedInstance().setCategoryModeOptionsError(AVAudioSessionCategoryPlayback, AVAudioSessionModeDefault, AVAudioSessionCategoryOptions.MixWithOthers);
if (typeof AVAudioSession.sharedInstance().setCategoryModeOptionsError === "function") {
// if music was playing, it would stop unless we do this:
AVAudioSession.sharedInstance().setCategoryModeOptionsError(AVAudioSessionCategoryPlayback, AVAudioSessionModeDefault, AVAudioSessionCategoryOptions.MixWithOthers);
}
}
}

Expand Down Expand Up @@ -90,8 +92,10 @@ export class BarcodeScanner {
private _device: AVCaptureDevice;

constructor() {
// play nice with others
AVAudioSession.sharedInstance().setCategoryModeOptionsError(AVAudioSessionCategoryPlayback, AVAudioSessionModeDefault, AVAudioSessionCategoryOptions.MixWithOthers);
if (typeof AVAudioSession.sharedInstance().setCategoryModeOptionsError === "function") {
// if music was playing, it would stop unless we do this:
AVAudioSession.sharedInstance().setCategoryModeOptionsError(AVAudioSessionCategoryPlayback, AVAudioSessionModeDefault, AVAudioSessionCategoryOptions.MixWithOthers);
}

this._device = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo);
if (this._device && this._device.hasTorch && this._device.hasFlash) {
Expand Down

0 comments on commit 933f597

Please sign in to comment.