Upgrade to Pro — share decks privately, control downloads, hide ads and more …

パラレルの通話を支える iOS アプリ上での技術

パラレルの通話を支える iOS アプリ上での技術

84e9eed4cd2df442347ff56aae03868c?s=128

Naoki ISHIKAWA

July 30, 2021
Tweet

More Decks by Naoki ISHIKAWA

Other Decks in Technology

Transcript

  1. Naoki ISHIKAWA @jarinosuke 2021/7/29 iOS Tech talk ύϥϨϧͷ௨࿩Λࢧ͑Δ iOS ΞϓϦ্Ͱͷٕज़

    1
  2. ࣗݾ঺հ 2

  3. ࣗݾ঺հ • 2010೥ʹϠϑʔʢYahoo! JAPANʣʹΤϯδχΞͱͯ͠ೖࣾɻͦͷޙΠάχε ʹͯ਺ेݸͷΞϓϦ։ൃܦݧΛܦͯɺ2016೥ʹϝϧΧϦ΁స৬ɻϝϧϖΠ։ ൃɺΤϯδχΞϦϯάϚωʔδϟʔΛܦͯ2020೥11݄ʹύϥϨϧʹೖࣾɻ • https://www.wantedly.com/companies/parallel/post_articles/333769 3

  4. ΞδΣϯμ • ✅ࣗݾ঺հ • ύϥϨϧͷઆ໌ • ύϥϨϧͷΞϓϦ্Ͱ࣮ݱ͍ͨ͜͠ͱ • ࢖͍ͬͯΔ֤ٕज़ͷৄࡉ 4

  5. ύϥϨϧͷઆ໌ 5

  6. Copyright © Parallel Inc. All Rights Reserved. ༑ୡͱ༡΂Δ௨࿩ΞϓϦʮύϥϨϧʯ 6 App

    Store ධՁɿ4.7/5.0ʢ 2.3ສ݅ʣ ύϥϨϧ͸஥ͷྑ͍༑ୡͱ௨࿩Λܨ͗ͳ͕ΒɺήʔϜͨ͠ΓಈըΛݟͨΓͯ͠༡΂Δ௨࿩ΞϓϦͰ͢ ᶃ ๛෋ͳ௨࿩ػձͷ૑ग़ • ༑ୡͷεςʔλεදࣔ • ؆୯ελϯϓΞΫγϣϯ • ௨࿩։࢝࣌ͷϓογϡ௨஌ ᶄ ࠷దͳ௨࿩؀ڥ • ݸผʹ௨࿩ԻྔΛௐ੔Մೳ • ѹ౗తʹ௿஗Ԇͳ௨৴ ᶅ εϚϗ࠷దԽ͞ΕͨUI/U X • ొ࿥͸10ඵͰ׬ྃ • ࢖͍׳ΕͨUI/UXͰ͙͢ʹ࢖͑Δ ᶆ Ұॹʹ༡΂ΔύʔςΟʔίϯςϯπ • αΫοͱ༑ୡͱ༡΂Δίϯςϯπ͕๛෋ • ϘλϯҰͭͰڞಉମݧ͕Մೳ
  7. ύϥϨϧͷΞϓϦ্Ͱ࣮ݱ͍ͨ͜͠ͱ 7

  8. ύϥϨϧͷΞϓϦ্Ͱ࣮ݱ͍ͨ͜͠ͱ • ߴ඼࣭ͳԻ੠ • ϦΞϧλΠϜͳϝοηʔδϯά • ༷ʑͳϑΥʔϚοτͷίϯςϯπͷಋೖ 8

  9. ύϥϨϧͷΞϓϦ্Ͱ࣮ݱ͍ͨ͜͠ͱ • ߴ඼࣭ͳԻ੠ • ϦΞϧλΠϜͳϝοηʔδϯά • ༷ʑͳϑΥʔϚοτͷίϯςϯπͷಋೖ 9

  10. ϦΞϧλΠϜͳϝοηʔδϯά • HTTPS + Push ௨஌Ҏ্ʹ ϦΞϧλΠϜੑΛߴΊ͍ͨ • ϢʔβʔͷΦϯϥΠϯ౳ͷදࣔɺνϟοτૹ৴ɺϧʔϜͷঢ়ଶมԽ •

    WebSocket • Starscream 10
  11. WebSocket ֓ཁ • ௨࿩࣌ • background ਐೖ࣌΋઀ଓΛܧଓ • background mode:

    audio Λࢦఆ͍ͯ͠ΔͷͰɺ௨࿩த͸ background Ͱ΋ main thread ͷϥϯϧʔϓ͸ܧଓ͢ΔͨΊ • ඇ௨࿩࣌ • background ਐೖ࣌ʹ੾அɺforeground ʹ໭ͬͨ࣌ʹ઀ଓ 11
  12. WebSocket ֓ཁ • ௨࿩࣌ • background ਐೖ࣌΋઀ଓΛܧଓ • background mode:

    audio Λࢦఆ͍ͯ͠ΔͷͰɺ௨࿩த͸ background Ͱ΋ main thread ͷϥϯϧʔϓ͸ܧଓ͢ΔͨΊ • ඇ௨࿩࣌ • background ਐೖ࣌ʹ੾அɺforeground ʹ໭ͬͨ࣌ʹ઀ଓ 12
  13. WebSocket background Ͱ௨࿩தʹ੾Εͯ͠·͏ݪҼͱରॲํ๏ • ݪҼ • background ௨࿩தʹ௨৴͕ Cellular <->

    WiFi Ͱมߋ͞Εͨͱ͖ • ରॲ • heartbeat(ping/pong) ͷಋೖ • ఆظతʹ Timer Λ࢖ͬͯૄ௨֬ೝ 13
  14. ύϥϨϧͷΞϓϦ্Ͱ࣮ݱ͍ͨ͜͠ͱ • ߴ඼࣭ͳԻ੠ • ✅ϦΞϧλΠϜͳϝοηʔδϯά • ༷ʑͳϑΥʔϚοτͷίϯςϯπͷಋೖ 14

  15. ༷ʑͳϑΥʔϚοτͷίϯςϯπͷಋೖ • iOS Native • WebView • Unity as a

    Library • Broadcast Extension 15
  16. ༷ʑͳϑΥʔϚοτͷίϯςϯπͷಋೖ • iOS Native • WebView • Unity as a

    Library • Broadcast Extension 16
  17. Unity as a Library • ʲUnityʳMirrativͷEmbedding UnityΛߋ৽ͨ͠࿩: ࣮ફ Unity as

    a Library • ͪ͜ΒΛࢀߟʹΞϓϦʹ݁߹ • ੒Ռ෺ UnityFramework.framework Λ repos ʹ push ͢Δ • ͦͷ repos Λ submodule ͰऔΓࠐΉ ؀ڥߏங 17
  18. Unity as a Library • Unity ͸ UIWindow Λ΋͏Ұͭ࡞੒͍ͯ͠Δ •

    Unity ͱ app ͷ window Λަޓʹ makeKeyAndVisible ͠ͳ͕Βը໘ભҠ • Unity ͷ view ্ʹɺUIViewController ΛΦʔόʔϨΠ͍ͤͯ͞Δ • Unity -> Native ͷϝοηʔδϯά • Unity ͷதʹ NativeCallsProxy protocol Λఆٛ • ͦΕʹద߹ͨ͠ object ΛΞϓϦଆͰ `FrameworkLibAPI.registerAPIforNativeCalls` ݺ ͼग़͠ొ࿥ ࣮૷ 18
  19. Unity as a Library • େมͳͱ͜Ζ • όΠφϦαΠζ͕େ͖͘ͳΔ • Unity

    ݻ༗ͷΫϥογϡ͕ൃੜ͢Δ • Ϋϥογϡϩάͷղੳ͕೉͍͠ ࣮૷ 19
  20. Broadcast Extension • ը໘ڞ༗ʹ༻͍Δ • ReplayKit (2) Λ࢖༻ • 2

    ͔ΒγεςϜඪ४ͷUIΛ࢖ͬͯɺ୺຤ʹөΔը໘Λ഑৴Ͱ͖ΔΑ͏ʹ • Կ͔ͱෆ҆ఆ • Invalid broadcast session Ͱݕࡧ͢Δͱɺը໘ڞ༗Λαϙʔτ͍ͯ͠Δ ΞϓϦ͕Θ͔Δ ֓ཁ 20
  21. Broadcast Extension • App <-> Broadcast Extension ؒͷΠϕϯτ௨஌͕೉͍͠ • ࣮ࡍͷը໘ڞ༗ͷ։࢝ͱऴྃΛΞϓϦଆͰ஌Γ͍ͨ

    • capturedDidChangeNoti fi cation ΍ UIScreen.isCaptured ͸͋Δ • ͜Εͩͱը໘ڞ༗͚ͩͰͳ͘ɺ࿥ը΍ AirPlay ΋ର৅ʹͳͬͯ͠·͏ • App Group ܦ༝ͰϑϥάΛड͚౉͍ͯ͠Δ(!!!) ࣮૷ 21
  22. ΞδΣϯμ • ✅ࣗݾ঺հ • ✅ύϥϨϧͷઆ໌ • ✅ύϥϨϧͷΞϓϦ্Ͱ࣮ݱ͍ͨ͜͠ͱ • ✅࢖͍ͬͯΔ֤ٕज़ͷৄࡉ 22

  23. ͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ 23