Slide 1

Slide 1 text

Ի੠ΞϓϦʹ͓͚Δ όοΫάϥ΢ϯυ࠶ੜ Tips entaku

Slide 2

Slide 2 text

entaku • Name: entaku • Job: iOS/AndroidΤϯδχΞͳͲ • SIer໿6೥ • εϙʔπϚονϯάΞϓϦ1೥ • ෺ྲྀITαʔϏε ໿2೥ • Voicy ->New • Twitter • @entaku_0818

Slide 3

Slide 3 text

Voicy https://corp.voicy.jp/ https://voicy.jp/

Slide 4

Slide 4 text

Voicy https://apps.apple.com/jp/app/voicy-recorder/id1115553195 iOS Android

Slide 5

Slide 5 text

ࠓճͷςʔϚ

Slide 6

Slide 6 text

໰୊ • Voicyௌ͖ͳ͕ΒଞͷԻָྲྀΕΔܥίϯςϯπ ͷβοϐϯά͕Ͱ͖ͳ͍

Slide 7

Slide 7 text

AVAudioSession https://developer.apple.com/documentation/avfaudio/avaudiose • ΞϓϦͰར༻͢ΔԻ੠ͷछྨͳͲΛઃఆ

Slide 8

Slide 8 text

AVAudioSession ͷαϯϓϧίʔυ /// Set session category. @available(iOS 3.0, *) open func setCategory(_ category: AVAudioSession.Category) throws /// Set session category with options. @available(iOS 6.0, *) open func setCategory(_ category: AVAudioSession.Category, options: AVAudioSession.CategoryOptions = []) throws /// Set session category and mode with options. @available(iOS 10.0, *) open func setCategory(_ category: AVAudioSession.Category, mode: AVAudioSession.Mode, options: AVAudioSession.CategoryOptions = []) throws

Slide 9

Slide 9 text

AVAudioSession ͷαϯϓϧίʔυ /// Set session category. @available(iOS 3.0, *) open func setCategory(_ category: AVAudioSession.Category) throws /// Set session category with options. @available(iOS 6.0, *) open func setCategory(_ category: AVAudioSession.Category, options: AVAudioSession.CategoryOptions = []) throws /// Set session category and mode with options. @available(iOS 10.0, *) open func setCategory(_ category: AVAudioSession.Category, mode: AVAudioSession.Mode, options: AVAudioSession.CategoryOptions = []) throws • VoicyͰར༻

Slide 10

Slide 10 text

AVAudioSession - category • soloAmbient • ΦʔσΟΦΛόοΫάϥϯυΦʔσΟΦͱϛοΫε͠ͳ͍ΞϓϦ༻ʢσϑΥϧτʣ ͷΧςΰϦͰ͢ɻ • ambient • ΦʔσΟΦΛόοΫάϥϯυΦʔσΟΦͱϛοΫε͢ΔΞϓϦ༻ʢϘλϯԻ΍ ΧʔφϏԻ੠Ҋ಺ͷΈͳͲʣͷΧςΰϦͰ͢ɻ • playback • ΦʔσΟΦ࠶ੜ༻ͷΧςΰϦͰ͢ɻ • record • ΦʔσΟΦ࿥Ի༻ͷΧςΰϦͰ͢ɻ https://developer.apple.com/documentation/avfaudio/avaudiosession/category

Slide 11

Slide 11 text

AVAudioSession - category • playAndRecord • ΦʔσΟΦ࠶ੜͱ࿥ԻΛ྆ํߦ͏ΞϓϦ༻ʢVoIPͳͲʣͷΧςΰϦͰ͢ɻ • multiRoute • ΦʔσΟΦΛҟͳΔσόΠεʹಉ࣌ग़ྗ͢ΔΞϓϦ༻ͷΧςΰϦͰ͢ɻ https://developer.apple.com/documentation/avfaudio/avaudiosession/category

Slide 12

Slide 12 text

AVAudioSession - Mode • default • σϑΥϧτͷϞʔυͰ͢ɻ • gameChat • ήʔϜνϟοτͰͷར༻Λࣔ͢ϞʔυͰ͢ɻ • measurement • ΦʔσΟΦೖग़ྗͷଌఆͰͷར༻Λࣔ͢ϞʔυͰ͢ɻ • moviePlayback • өը࠶ੜͰͷར༻Λࣔ͢ϞʔυͰ͢ɻ https://developer.apple.com/documentation/avfaudio/avaudiosession/category

Slide 13

Slide 13 text

AVAudioSession - Mode • spokenAudio • Ի੠ͷׂΓࠐΈ͕͋ΔΞϓϦͰͷར༻Λࣔ͢ϞʔυͰ͢ɻΧʔφϏԻ੠Ҋ಺ͳͲɺ୹ׂ͍ΓࠐΈͷࡍʹ࠶ੜதͷ΋ ͷΛҰ࣌ఀࢭ͠ɺऴΘΓ࣍ୈ࠶։͠·͢ɻ • videoChat • ΦϯϥΠϯϏσΦձٞͰͷར༻Λࣔ͢ϞʔυͰ͢ɻ • videoRecording • ಈը࿥ըͰͷར༻Λࣔ͢ϞʔυͰ͢ɻ • voiceChat • VoIPͳͲͷ૒ํ޲ͷԻ੠௨৴Ͱͷར༻Λࣔ͢ϞʔυͰ͢ɻ • voicePrompt • ςΩετಡΈ্͛Λ࢖༻ͨ͠Ի੠࠶ੜͰͷར༻Λࣔ͢ϞʔυͰ͢ɻ https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/

Slide 14

Slide 14 text

AVAudioSession - Option • mixWithOthers • ΦʔσΟΦ͕όοΫάϥ΢ϯυΦʔσΟΦͱϛοΫε͢Δ͜ͱΛࣔ͢Φϓγϣϯɻ • duckOthers • ΦʔσΟΦ࠶ੜ࣌ʹɺόοΫάϥ΢ϯυΦʔσΟΦͷԻྔΛԼ͛ΔΦϓγϣϯɻ • InterruptSpokenAudioAndMixWithOthers • ΦʔσΟΦΛ࠶ੜ࣌ʹɺόοΫάϥ΢ϯυΦʔσΟΦΛҰ࣌ఀࢭ͢Δ͔Ͳ͏͔Λܾఆ͢ΔΦ ϓγϣϯɻ • allowBluetooth • BluetoothϋϯζϑϦʔσόΠεΛ࢖༻Մೳͳೖྗϧʔτͱͯ͠දࣔ͢Δ͔Ͳ͏͔Λܾఆ͢Δ Φϓγϣϯɻ https://developer.apple.com/documentation/avfaudio/avaudiosession/ categoryoptions

Slide 15

Slide 15 text

AVAudioSession - Option • spokenAudio • Ի੠ͷׂΓࠐΈ͕͋ΔΞϓϦͰͷར༻Λࣔ͢ϞʔυͰ͢ɻΧʔφϏԻ੠Ҋ಺ͳͲɺ୹ׂ͍ΓࠐΈͷࡍʹ࠶ੜதͷ΋ ͷΛҰ࣌ఀࢭ͠ɺऴΘΓ࣍ୈ࠶։͠·͢ɻ • videoChat • ΦϯϥΠϯϏσΦձٞͰͷར༻Λࣔ͢ϞʔυͰ͢ɻ • videoRecording • ಈը࿥ըͰͷར༻Λࣔ͢ϞʔυͰ͢ɻ • voiceChat • VoIPͳͲͷ૒ํ޲ͷԻ੠௨৴Ͱͷར༻Λࣔ͢ϞʔυͰ͢ɻ • voicePrompt • ςΩετಡΈ্͛Λ࢖༻ͨ͠Ի੠࠶ੜͰͷར༻Λࣔ͢ϞʔυͰ͢ɻ https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions

Slide 16

Slide 16 text

AVAudioSessionͬͯͨ͘͞Μ ઃఆ͕͋ΔΜͩͶʂ

Slide 17

Slide 17 text

Ͱ݁ہͲ͏͢Μͷʁ

Slide 18

Slide 18 text

AVAudioSession ͷαϯϓϧίʔυ ɹɹɹɹɹtry? audioSession.setCategory(AVAudioSession.Category.playback) OR ɹɹɹɹɹtry? audioSession.setCategory(AVAudioSession.Category.soloAmbient) OR ɹɹɹɹ// background try? audioSession.setCategory(AVAudioSession.Category.ambient, options: AVAudioSession.CategoryOptions.mixWithOthers) ※ίʔυ͸ΠϝʔδͰ͢

Slide 19

Slide 19 text

backGround͔Ͳ͏͔ͷ൑ఆ ɹɹɹɹɹif (secondaryAudioShouldBeSilencedHint){ ɹ// background try? audioSession.setCategory(AVAudioSession.Category.ambient, options: AVAudioSession.CategoryOptions.mixWithOthers) }else{ // forground // Ϣʔβʔͷঢ়ଶʹΑͬͯ࢖͍෼͚ try? audioSession.setCategory(AVAudioSession.Category.playback) OR ɹɹɹɹɹtry? audioSession.setCategory(AVAudioSession.Category.soloAmbient) } ɹɹɹ ※ίʔυ͸ΠϝʔδͰ͢

Slide 20

Slide 20 text

backGround͔Ͳ͏͔ͷ൑ఆ https://developer.apple.com/documentation/avfaudio/avaudiosession/1616600-secondaryaudioshouldbesilencedhi • This property returns true if any other audio is playing, including audio from an app using the ambient category. Most apps should instead use the secondaryAudioShouldBeSilencedHint property, because it’s more restrictive when considering whether primary audio from another app is playing. https://developer.apple.com/documentation/avfaudio/avaudiosession/1616610-isotheraudioplaying • secondaryAudioShouldBeSilencedHintΛ ࢖͏

Slide 21

Slide 21 text

BackGround࠶ੜͰؾΛ͚ͭΔ ͜ͱ • AVAudioSessionͷछྨ͸ͨ͘͞Μ͋ΔͷͰࣗ෼ͷΞϓϦͰͲͷ ઃఆ͕߹͍ͬͯΔͷ͔͸֬ೝ͢Δඞཁ͕͋Δ • Ի੠͕όοΫάϥ΢ϯυʹདྷ͍ͯΔ͔Ͳ͏͔͸ secondaryAudioShouldBeSilencedHintΛ࢖͏ • isOtherAudioPlayingࣄྫ͋ͬͨΒڭ͍͑ͯͩ͘͠

Slide 22

Slide 22 text

࠷ޙʹ

Slide 23

Slide 23 text

https://voicy.jp/search/entaku ฉ͍ͯ͘ΕΑͳ😊

Slide 24

Slide 24 text

https://www.wantedly.com/projects/619248 Ԡԉ͚ͩͯ͘͠ΕΑͳ😊