Pro Yearly is on sale from $80 to $50! »

たのしいAirPlay

 たのしいAirPlay

Streaming Conference #6 での発表資料です。
https://streaming-lab.connpass.com/event/121623/

E2c86baa99178b8400a2ef49ef861a6c?s=128

toshi0383

March 27, 2019
Tweet

Transcript

  1. ͨͷ͍͠AirPlay 2019/03/27 Toshihiro Suzuki

  2. ετϦʔϛϯάΫϥΠΞϯτ

  3. • ΞδΣϯμ • جຊฤ • Ԡ༻ฤ(͓·͚)

  4. جຊฤ

  5. ࢖͍ํ ίϯτϩʔϧηϯλʔ AirPlayϘλϯ(MPVolumeView) ҎԼͷμΠΞϩά͸࣮૷͢Δඞཁͳ͠ʢͰ͖ͳ͍ʣ

  6. AirPlay࠶ੜͱ͸ • AppleTVΛհͨ͠ɺ֎෦σΟεϓϨΠଆͰͷϑϧεΫϦʔϯ࠶ੜ • ϛϥʔϦϯάͱ͸ҟͳΔ

  7. AirPlay != ϛϥʔϦϯά ίϯτϩʔϧηϯλʔ Lightning => HDMIίωΫλ

  8. AirPlay != ϛϥʔϦϯά AirPlay Mirroring ϑϧεΫϦʔϯಈը࠶ੜ ಈըʹؔ܎ͳ͘*1ɺ
 iPhoneͷը໘͕ͦͷ··දࣔ͞ΕΔ͚ͩ iPhoneଆͰ͸࠶ੜ͞Εͳ͍ɻ *1

    DRMͷ৔߹͸ಈը͚͕ͩදࣔ͞Εͳ͍౳ͷOS੍ޚ͕ೖΔ
  9. ੍ݶ͢Δϑϥά • AVPlayer.allowsExternalPlayback • AVPlayer.usesExternalPlaybackWhileExternalScreenIsActive ֎෦σΟεϓϨΠͰͷ࠶ੜΛڐՄ͢Δ͔Ͳ͏͔ ֎෦σΟεϓϨΠ͕͋Δ࣌ʹAirPlay࠶ੜΛࣗಈͰ։࢝͢Δ͔Ͳ͏͔

  10. AVPlayer allowsExternalPlayback • True: AirPlay΍HDMIܦ༝ͰͷಈըɾԻ੠࠶ੜ͕Մೳ • False: AirPlay΍HDMIܦ༝Ͱͷಈը࠶ੜ͕ېࢭ͞ΕΔ

  11. AVPlayer allowsExternalPlayback • True: AirPlay΍HDMIܦ༝ͰͷಈըɾԻ੠࠶ੜ͕Մೳ • False: AirPlay΍HDMIܦ༝Ͱͷಈը࠶ੜ͕ېࢭ͞ΕΔ

  12. AVPlayer allowsExternalPlayback: False Ի੠͸ૹ৴͞Εͯ͠·͏ • ࢓༷ɻ • ࢀߟ: ະղܾͷSO: https://stackoverflow.com/questions/

    43041220/disable-airplay-with-allowsexternalplayback- but-audio-is-still-playing
  13. AVPlayer usesExternalPlaybackWhileExternalScree nIsActive • ֎෦σΟεϓϨΠ͕͋Δ࣌ʹAirPlay࠶ੜΛࣗಈͰ։࢝͢Δ ͔Ͳ͏͔

  14. ϛϥʔϦϯά + ಈը࠶ੜத ͷ৚݅ͰউखʹAirPlay͢Δ͔Ͳ͏͔ AirPlay Mirroring ϑϧεΫϦʔϯಈը࠶ੜ ಈըʹؔ܎ͳ͘*1ɺ
 iPhoneͷը໘͕ͦͷ··දࣔ͞ΕΔ͚ͩ iPhoneଆͰ͸࠶ੜ͞Εͳ͍ɻ

    =>
  15. ঢ়ଶΛऔಘ͢Δ • AVPlayer.isExternalPlaybackActive • ಈը࠶ੜʹ͔͔ΘΒͣɺAirPlayதɺMirroringதͷݕ஌ʁ ֎෦σΟεϓϨΠͰͦͷಈը͕࠶ੜத͔Ͳ͏͔ ૉ௚ͳAPI͸ͳ͍

  16. AirPlay / Mirroringݕ஌ͷ࡞Γํ

  17. AirPlay / Mirroringݕ஌ͷ࡞Γํ ·ͣࣗલͷϑϥάΛ༻ҙ͠·͢ɻ NSNotification΍KVOΛى఺ͱ͢Δ

  18. AirPlay / Mirroringݕ஌ͷ࡞Γํ ࣮ػͰಈ࡞֬ೝͯ͠ϚτϦΫεʹ͠·͢ɻ

  19. AirPlay / Mirroringݕ஌ͷ࡞Γํ ϑϥά͕ݕ஌͍ͨ͠ঢ়ଶʹͳͬͨ࣌ʹॲཧΛ͢Δɻ ྫ: AppleTVʹAirPlay઀ଓ͍ͯ͠Δ࣌͸GoogleCastϘλϯΛදࣔ͠ͳ͍ɺͳͲɻ

  20. • AirPlay઀ଓத: isAirPlaying:true && isMirroring:false • AirPlay࠶ੜத: AirPlay઀ଓத && isExternalPlaybackActive

    • ϛϥʔϦϯά઀ଓத: isMirroring:true usesExternalPlaybackWhileExternalScreenIsActive:falseͷ৔߹ ͳΜͱ͔ͳΓͦ͏
  21. • AirPlay઀ଓத: isAirPlaying:true && isMirroring:false • AirPlay࠶ੜத: AirPlay઀ଓத && isExternalPlaybackActive

    • ϛϥʔϦϯά઀ଓத: isMirroring:true usesExternalPlaybackWhileExternalScreenIsActive:falseͷ৔߹ ͳΜͱ͔ͳΓͦ͏ ͨͩ͠
  22. AirPlay / Mirroringݕ஌ͷ஫ҙ఺ ֤ϑϥά͸͙͢ʹ੾ΓସΘΓ·ͤΜɻ ޡݕ஌Λ๷͙ͨΊɺ࠷௿0.5ඵఔ౓͸଴ͭඞཁ͕͋Γ·͢ɻ

  23. AirPlay / Mirroringݕ஌ͷ࡞Γํ օ͞Μ΋ͥͻ͓͏ͪͰ࡞ͬͯΈͯͶ

  24. ͜͜Ͱɺ abema-iosͷࠓճͷରԠʹ͍ͭͯ • ΞϓϦ಺ʹAirPlayϘλϯͷ࣮૷͸ͳ͔ͬͨɻ • ֎෦ग़ྗ(allowsExternalPlayback)͸ېࢭ͍ͯ͠ͳ͔ͬͨͨΊɺ ίϯτϩʔϧηϯλʔ͔Β͸AirPlay࠶ੜͰ͖ͨɻ • ͱΓ͋͑ͣAirPlayϘλϯ͚ͩग़ͦ͏ɻ

  25. αΫοͱ࣮૷ ઌ΄Ͳͷϑϥάͷ࣮૷ʹΑͬͯɺϘλϯͷग़͠Θ ͚΍tintͷมߋ͕όονϦܾ·͍ͬͯΔɻ

  26. αΫοͱ࣮૷ ઌ΄Ͳͷϑϥάͷ࣮૷ʹΑͬͯɺϘλϯͷग़͠Θ ͚΍tintͷมߋ͕όονϦܾ·͍ͬͯΔɻ LGTM

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

  28. ͝੩ௌ͋Γ͕ͱ͏͟͝ ͍·ͨ͠ ͋Εʁ

  29. ͝੩ௌ͋Γ͕ͱ͏͟͝ ͍·ͨ͠ ࢹௌϩάऔΕͯͳ͘ͳ͍ʁ

  30. ͝੩ௌ͋Γ͕ͱ͏͟͝ ͍·ͨ͠ ͦΜͳ͸ͣ͸..

  31. timedMetadataऔΕͳ͍໰୊ • AppleTV 4th Gen.(2019೥3݄࣌఺Ͱ࠷৽ܕ)Ͱ͸ɺAirPlayதʹ timedMetadata͕औΕͳ͍ɻ • 3rd Gen.ͳΒऔΕΔɻ(ͦΕҎલͷόʔδϣϯ͸ະݕূͰෆ໌) •

    ʮόά͚ͩͲ௚͢༧ఆ͸ࠓͷͱ͜Ζ͋Γ·ͤΜʯ ࢹௌϩάɺ࠶ੜதͷίϯςϯπλΠτϧͷදࣔɺ൪એCMதͷ ࢹௌ༧໿ػೳͳͲɺଟ͘ͷػೳ͕timedMetadataґଘɻ
  32. ऴΘͬͨ

  33. ͨͷ͍͠AirPlay جຊฤ͓ΘΓ

  34. Ԡ༻ฤ(͓·͚)

  35. εΫϦʔϯϨίʔσΟϯά • iOS11~ • UIScreen.isCaptured͸ϛϥʔϦϯάͰ΋ ൓Ԡ͢Δ఺ʹ஫ҙɻ • AirPlay࠶ੜத͸֎෦σΟεϓϨΠଆ͕࿥ը ͞ΕΔ͜ͱ͸ͳ͔ͬͨɻ •

    ΞϓϦଆͰ͸࠶ੜ͞Εͳ͍ͨΊɺAirPlay࠶ ੜதͷ࿥ը͸ڐՄͯ͠໰୊ͳ͍͸ͣɻ
  36. όοΫάϥ΢ϯυ࠶ੜͰAirPlay ͸ܧଓͰ͖Δͷʁ • Ͱ͖·͢ɻ • AVPlayer.usesExternalPlaybackWhileExternalScreenIsA ctive: True ͩͱ͏·͍͔͘ͳ͔ͬͨͨΊ஫ҙɻ

  37. FairPlay • DRMͷ৔߹͸جຊతʹOSଆͰ֎෦ग़ྗ͸੍ݶ͞ΕΔɻΞ ϓϦଆ͸੍ޚ͢Δඞཁ͕ͳ͍΋͘͠͸Ͱ͖ͳ͍ɻ • AirPlayͱ੾Γସ͑Δͱ࠶ੜηογϣϯͱͯ͠͸ผѻ͍ʹͳ Δ໛༷ͰɺFairPlayͷ࢓༷ͰΩʔͷ࠶औಘ͕࣮ߦ͞ΕΔɻͦ ͷͨΊAirPlayͱ௨ৗ࠶ੜͰckcσʔλʢ෮߸ΩʔʣΛ࢖͍ ճ͢͜ͱ͸ෆՄೳɻʢ࢖͍ճͨ͠ͱͯ͠΋࠶ੜΤϥʔͱͳ Δʣ

  38. FairPlay • AirPlay͸ωοτϫʔΫ͕͋Δલఏͷ ͨΊ͔ɺPersistent Content Key΋ ར༻ෆՄɻ • persistentContentKey͕࢖͑Δલఏ Ͱ࣮૷͍ͯ͠ΔͱDRMίϯςϯπ

    ͕࠶ੜΤϥʔʹͳΔͨΊ஫ҙɻ
  39. ഒ଎࠶ੜͱAppleTV Remote • AppleTV Remote͔Βpause=>play͢Δͱ rate:1.0ʹ໭ͬͯ͠·͍ɺ࠶ੜ଎౓͕ΞϓϦͷ දࣔͱ৯͍ҧ͏ঢ়ଶʹͳΔ • YouTube, dTVΛ֬ೝͨ͠ͱ͜ΖಛʹରԠͯ͠

    ͓ΒͣɺϢʔβ͕࠶౓࠶ੜ଎౓Λઃఆ͠௚͢ ඞཁ͕͋Δɻ • ͜ͷέʔεΛݕ஌ͯ͠࠶౓rateΛηοτ͠௚͢ ͜ͱͰղܾͰ͖Δ͕ɺҰॠrate:1.0ͷ··࠶ੜ ͞ΕΔͷ͸ճආͰ͖ͳ͍ɻ
  40. AirPlayͨͷ͍͠ • AirPlay != ϛϥʔϦϯά • ϑϥάྨͷ؅ཧ͕ҙ֎ͱ൥ࡶͳͷͰɺؾΛ͚ͭ·͠ΐ͏ɻ • timedMetadata͸औΕ·ͤΜɻ

  41. ͓͠·͍

  42. ϝϯόʔ΅͠Ύ͏ • ετϦʔϛϯάΫϥΠΞϯτ • ഑৴αʔόʔ • ίϯςϯπϚωδϝϯτ • etc.. ͨͷ͍͠՝୊͕͍ͬͺ͍ʂ