Commit graph

53 commits

Author SHA1 Message Date
Matthew Chen 32b87d0e58 Remove custom ringtones. 2018-02-26 14:47:57 -05:00
Matthew Chen 99aedca45f Strip out special casing for pre-iOS 9 users. 2018-02-26 14:13:38 -05:00
Matthew Chen a0f4723fa2 Update call sounds. 2018-02-23 12:53:43 -05:00
Michael Kirk 8dfe06e3f2 Ensure audio session is default after call is terminated.
Previously, we were enabling PlayAndRecord when a call ended due to the
CallService observer's "updateVideoTrack" callbacks.

// FREEBIE
2018-02-18 15:35:37 -05:00
Michael Kirk c646f76335 Garther audio concerns, clean up session when done
- sync speakerphone state manipulated from system call screen
  - Revert audio session after call failure, ensures media plays out of
    speaker after placing a failing call.
  - Replace notification with delegate pattern since we're already using
    delegate pattern here.
- Fixes voiceover accessibility after voice memo
- Avoid audio blip after pressing hangup
- Rename CallAudioSession -> OWSAudioSession
  Going to start using it for other non-call things since we want to
  gather all our audio session concerns.
- Resume background audio when done playing video
  - Extract OWSVideoPlayer which ensures audio is in proper state before
    playback
  - Move recording session logic to shared OWSAudioSession
  - Deactivate audio session when complete

// FREEBIE
2018-02-06 18:45:51 -08:00
Matthew Chen 7a1e47cd26 Add asserts around Swift singletons. 2017-12-07 13:57:45 -05:00
Matthew Chen 9da165b846 Continue conversion of app setup. 2017-12-05 11:19:11 -05:00
Matthew Chen 8cc33b3de1 Refine loading view of share extension. 2017-12-01 10:48:18 -05:00
Michael Kirk a11d83187b WIP: Framework-friendly - compiles but crashes on launch
// FREEBIE
2017-11-29 13:58:27 -08:00
Michael Kirk 30b50e1489 Activate audio at the proper time
// FREEBIE
2017-11-20 14:35:16 -05:00
Michael Kirk c7642cc628 Fix volume burst when call connects
By centralizing AudioSession management onto the AudioService, we can
avoid enabling the RTCAudioSession while we're mid-ring.

Also allows us to centralize and remove redundant audio session logic.

// FREEBIE
2017-11-02 08:49:46 -04:00
Michael Kirk 402d4157c8 Uniform volume when ringing on speakerphone vs video
// FREEBIE
2017-11-02 08:49:46 -04:00
Michael Kirk 3d3af21792 CR: clarify comment, proper linewrap
// FREEBIE
2017-10-05 13:02:39 -04:00
Michael Kirk c3dc8508ab pre-PR cleanup
// FREEBIE
2017-10-05 13:02:38 -04:00
Michael Kirk ff2f9ebaf0 fix compiling on 32bit.
// FREEBIE
2017-10-05 13:02:38 -04:00
Matthew Chen 445f6dc6f8 Respond to CR.
// FREEBIE
2017-09-21 17:03:57 -04:00
Matthew Chen 35a2470cb7 Post notifications asynchronously.
// FREEBIE
2017-09-21 17:03:57 -04:00
Michael Kirk 9287b8560c clean up comments per code review
// FREEBIE
2017-07-15 17:11:41 -04:00
Michael Kirk fb5c17a6b4 minimize sound overlap
Because there is some asynchrony involved, there may be a blip during
the switch between sounds/audio sessions

// FREEBIE
2017-07-15 17:11:41 -04:00
Michael Kirk e3faddedbc Disallow bluetooth when user has opted for local receiver
// FREEBIE
2017-07-15 17:11:41 -04:00
Michael Kirk 524ba80b75 WIP: have ensureAudioSession set preferred input
Call it all the time, but only mutate the AVAudioSession when necessary

TODO

Can't switch to iPhone

// FREEBIE
2017-07-15 17:11:41 -04:00
Michael Kirk 220cd345f6 add comments
// FREEBIE
2017-07-15 17:11:41 -04:00
Michael Kirk ba97ff3f5f Label tweaks for device listing
// FREEBIE
2017-07-15 17:11:41 -04:00
Michael Kirk b8ec353d77 Use recommended approach for speakerphone mode
From: https://developer.apple.com/library/content/qa/qa1754/_index.html

Q:  Can you explain the difference between calling the AVAudioSession method overrideOutputAudioPort: with the value AVAudioSessionPortOverrideSpeaker and using the category option AVAudioSessionCategoryOptionDefaultToSpeaker with setCategory:withOptions:error:.

A: The difference is that setting the AVAudioSessionPortOverride by calling overrideOutputAudioPort: is more transient than using the category option AVAudioSessionCategoryOptionDefaultToSpeaker.

Important: The use of both AVAudioSessionPortOverrideSpeaker and AVAudioSessionCategoryOptionDefaultToSpeaker are only applicable to the AVAudioSessionCategoryPlayAndRecord category.
Calling overrideOutputAudioPort: and setting the AVAudioSessionPortOverride to AVAudioSessionPortOverrideSpeaker is a way of temporarily overriding the output to play to the speaker. Any route change or interruption will cause the audio to be routed back to its normal route, following the last-in wins rule. Think of using overrideOutputAudioPort: in terms of what you might use to implement a Speakerphone button where you want to be able to toggle between the speaker (AVAudioSessionPortOverrideSpeaker) and the normal output route (AVAudioSessionPortOverrideNone).

Note: This property is intended to allow 3rd party applications to mimic the behavior of a Speakerphone button and therefore may change the input route as well as output route. For example, setting the AVAudioSessionPortOverride to AVAudioSessionPortOverrideSpeaker while a headset is plugged in will cause the route to change to built-in mic / built-in speaker.

// FREEBIE
2017-07-14 09:49:48 -04:00
Michael Kirk b495b23420 more cleanup and commenting
// FREEBIE
2017-07-13 17:08:42 -04:00
Michael Kirk 03f1bbca62 Move state from CallViewController -> Call
I think whenever reasonable we prefer to consodlidate state on the call

// FREEBIE
2017-07-13 17:08:42 -04:00
Michael Kirk 4e11e90ebb cleanup
- remove dead code
- rename vars
- add coments

// FREEBIE
2017-07-13 17:08:41 -04:00
Michael Kirk 9bd68ed490 WIP: bluetooth shows audio route button instead of speakerphone
// FREEBIE

TODO

NEED
-[ ] icon in route picker
-[ ] commit cleanup

NICE
-[ ] present action sheet automatically when making outgoing bluetooth call
-[ ] left align icons
-[ ] audio is paused when switching between video mode (maybe existing behavior, not sure)
-[ ] Copy: iPhone/iPad/iPod instead of "iPhone Microphone"

DONE
-[x] remove "receiver" from options while in video mode
-[x] show available audio routes
-[x] select available audio routes
-[x] notification if availabe inputs change so we can update call screen
     mid call with available BT route
-[x] include speakerphone in choices
-[x] Enabled button shows active speakerphone. Should still show
     bluetooth picker.
-[x] toggle back and forth between audio devices
-[x] hide audio route button in video mode if no BT available
-[x] Fixed: When on speakerphone - switching to video mode goes back to bluetooth.
-[x] Fixed: When switching to video w/ bluetooth device connected there is no
     audio picker.
-[x] respect speakerphone/BT selection when in or toggling to/from video
-[x] do not hide audio route button when in video mode and bluetooth
     connected
-[x] Show which is currently selected audio route
-[x] switching to speakerphone no longer works
-[x] switching *back* to bluetooth no longer works
-[x] add proper bluetooth button for audio calls
-[x] add proper bluetooth button for video calls
2017-07-13 17:08:41 -04:00
Matthew Chen d639d6557e Add owsFail free function for swift.
// FREEBIE
2017-07-11 16:20:20 -04:00
Michael Kirk f681712ea0 Code Cleanup
- make some logging clearer
- remove noisy unhelpful logging
- clearer method names

// FREEBIE
2017-07-10 11:09:39 -05:00
Michael Kirk d8330a2c4f Fix bluetooth audio for calls
Allow bluetooth in all call speaking modes. This was much simpler to fix
now that all call AudioSession mgmt happens in one method.

// FREEBIE
2017-07-06 17:54:14 -05:00
Michael Kirk 1e0cf89f7a Explanatory comment
// FREEBIE
2017-07-05 11:55:00 -05:00
Michael Kirk 43a3a4afaf play *after* stop
In theory this shouldn't make a difference, since we're not playing the
ringer twice, but in practice I fail to here ringer audio 50% of the
time (in DEBUG builds) while app is in the foreground.

// FREEBIE
2017-07-05 11:53:16 -05:00
Michael Kirk 8abde1dff8 Non-Callkit adapter plays audio from notification when app is in
background

// FREEBIE
2017-07-05 11:53:16 -05:00
Michael Kirk 17cff1a26d Revert "Merge branch 'charlesmchen/bluetoothAudio'"
This reverts commit 48a2005aa2, reversing
changes made to de1332479c.

// FREEBIE
2017-05-15 18:14:51 -04:00
Matthew Chen 6c9f44b99d Clean up ahead of PR.
// FREEBIE
2017-05-15 17:23:53 -04:00
Matthew Chen 7e18052c45 Fix Bluetooth audio in calls.
// FREEBIE
2017-05-15 17:23:53 -04:00
Michael Kirk d7c7fff679 Fix some compiler warnings
* explicit optional usage in strings
* remove some unused StringUtil code
* swiftlint affected files
* more concise optional casting (and avoid a `!`)

Compiler warnings: 343 -> 318

(Actually most of these are in external libs, but 115 remain in Signal/SSK)

// FREEBIE
2017-05-05 14:26:29 -04:00
Matthew Chen 0f85284b82 Fix speakerphone vs. WebRTC AND Fix CallService edge cases.
// FREEBIE
2017-05-03 09:34:39 -04:00
Matthew Chen c1aea91d1b Fix build break.
// FREEBIE
2017-02-27 14:46:19 -05:00
Michael Kirk b5403175f1 Call sounds - connecting, outgoing ring, busy sound.
Also add vibration for remote hangup so you're not talking to dead air.

// FREEBIE
2017-02-27 11:21:51 -05:00
Michael Kirk a328759f0d Don't crash when incoming call on NonCallKit iOS10
Previous logic assumed "VoiceChat" mode, but when the ringer goes off,
we set "SoloAmbient" which is incompatible with that mode, causing
assertion failure.

// FREEBIE
2017-02-03 10:24:16 -05:00
Michael Kirk 2a9aa4c852 users can opt out of CallKit
// FREEBIE
2017-02-02 19:09:37 -05:00
Matthew Chen d0b2aaac27 Specify AVAudioSession modes for calls.
// FREEBIE
2017-02-01 09:19:18 -05:00
Matthew Chen 5dd4655672 Ensure audio state when call connects.
// FREEBIE
2017-01-31 17:09:45 -05:00
Matthew Chen d560aa022a Reworked call view’s remote video mode. 2017-01-27 11:11:33 -05:00
Matthew Chen a65d3b7c4e Add video-related views.
// FREEBIE
2017-01-26 16:41:59 -05:00
Michael Kirk 333fb6c60f assert on main thread
// FREEBIE
2017-01-24 14:13:29 -05:00
Michael Kirk b2091431dc Fix retain cycle
// FREEBIE
2017-01-24 14:13:29 -05:00
Michael Kirk 87ed662116 Persist AudioService if CallViewController is dismissed
...in response to CR, move the AudioService off of the CallViewController

Adopt multiple observer pattern vs. a singular delegate. Doing so
required implementing some machinery to address the ARC (see:
Weak.swift)

// FREEBIE
2017-01-24 14:13:29 -05:00