Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
たのしいAirPlay
Search
toshi0383
March 27, 2019
Programming
1
660
たのしいAirPlay
Streaming Conference #6 での発表資料です。
https://streaming-lab.connpass.com/event/121623/
toshi0383
March 27, 2019
Tweet
Share
More Decks by toshi0383
See All by toshi0383
CoreDataはじめました
toshi0383
0
97
Swiftコードバトル必勝法
toshi0383
1
200
Sheets API使ってみた
toshi0383
2
250
visionOSについてGlobeeが取り組んでいること
toshi0383
0
430
agile20150512-150512055145-lva1-app6892.pdf
toshi0383
0
120
Profiling using Signpost
toshi0383
2
870
AVPlayer周りの設計tips
toshi0383
6
810
cmdshelf::from("Swift")
toshi0383
3
830
AbemaTV iOSのダウンロード再生機能
toshi0383
4
940
Other Decks in Programming
See All in Programming
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
100
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
860
AWS IaCの注目アップデート 2024年10月版
konokenj
3
3.3k
2024/11/8 関西Kaggler会 2024 #3 / Kaggle Kernel で Gemma 2 × vLLM を動かす。
kohecchi
5
920
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
110
EventSourcingの理想と現実
wenas
6
2.3k
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
610
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
250
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
32
1.5k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Producing Creativity
orderedlist
PRO
341
39k
Designing the Hi-DPI Web
ddemaree
280
34k
A Tale of Four Properties
chriscoyier
156
23k
Building Applications with DynamoDB
mza
90
6.1k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
0
89
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Rails Girls Zürich Keynote
gr2m
94
13k
Faster Mobile Websites
deanohume
305
30k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
506
140k
Transcript
ͨͷ͍͠AirPlay 2019/03/27 Toshihiro Suzuki
ετϦʔϛϯάΫϥΠΞϯτ
• ΞδΣϯμ • جຊฤ • Ԡ༻ฤ(͓·͚)
جຊฤ
͍ํ ίϯτϩʔϧηϯλʔ AirPlayϘλϯ(MPVolumeView) ҎԼͷμΠΞϩά࣮͢Δඞཁͳ͠ʢͰ͖ͳ͍ʣ
AirPlay࠶ੜͱ • AppleTVΛհͨ͠ɺ֎෦σΟεϓϨΠଆͰͷϑϧεΫϦʔϯ࠶ੜ • ϛϥʔϦϯάͱҟͳΔ
AirPlay != ϛϥʔϦϯά ίϯτϩʔϧηϯλʔ Lightning => HDMIίωΫλ
AirPlay != ϛϥʔϦϯά AirPlay Mirroring ϑϧεΫϦʔϯಈը࠶ੜ ಈըʹؔͳ͘*1ɺ iPhoneͷը໘͕ͦͷ··දࣔ͞ΕΔ͚ͩ iPhoneଆͰ࠶ੜ͞Εͳ͍ɻ *1
DRMͷ߹ಈը͚͕ͩදࣔ͞Εͳ͍ͷOS੍ޚ͕ೖΔ
੍ݶ͢Δϑϥά • AVPlayer.allowsExternalPlayback • AVPlayer.usesExternalPlaybackWhileExternalScreenIsActive ֎෦σΟεϓϨΠͰͷ࠶ੜΛڐՄ͢Δ͔Ͳ͏͔ ֎෦σΟεϓϨΠ͕͋Δ࣌ʹAirPlay࠶ੜΛࣗಈͰ։࢝͢Δ͔Ͳ͏͔
AVPlayer allowsExternalPlayback • True: AirPlayHDMIܦ༝ͰͷಈըɾԻ࠶ੜ͕Մೳ • False: AirPlayHDMIܦ༝Ͱͷಈը࠶ੜ͕ېࢭ͞ΕΔ
AVPlayer allowsExternalPlayback • True: AirPlayHDMIܦ༝ͰͷಈըɾԻ࠶ੜ͕Մೳ • False: AirPlayHDMIܦ༝Ͱͷಈը࠶ੜ͕ېࢭ͞ΕΔ
AVPlayer allowsExternalPlayback: False Իૹ৴͞Εͯ͠·͏ • ༷ɻ • ࢀߟ: ະղܾͷSO: https://stackoverflow.com/questions/
43041220/disable-airplay-with-allowsexternalplayback- but-audio-is-still-playing
AVPlayer usesExternalPlaybackWhileExternalScree nIsActive • ֎෦σΟεϓϨΠ͕͋Δ࣌ʹAirPlay࠶ੜΛࣗಈͰ։࢝͢Δ ͔Ͳ͏͔
ϛϥʔϦϯά + ಈը࠶ੜத ͷ݅ͰউखʹAirPlay͢Δ͔Ͳ͏͔ AirPlay Mirroring ϑϧεΫϦʔϯಈը࠶ੜ ಈըʹؔͳ͘*1ɺ iPhoneͷը໘͕ͦͷ··දࣔ͞ΕΔ͚ͩ iPhoneଆͰ࠶ੜ͞Εͳ͍ɻ
=>
ঢ়ଶΛऔಘ͢Δ • AVPlayer.isExternalPlaybackActive • ಈը࠶ੜʹ͔͔ΘΒͣɺAirPlayதɺMirroringதͷݕʁ ֎෦σΟεϓϨΠͰͦͷಈը͕࠶ੜத͔Ͳ͏͔ ૉͳAPIͳ͍
AirPlay / Mirroringݕͷ࡞Γํ
AirPlay / Mirroringݕͷ࡞Γํ ·ͣࣗલͷϑϥάΛ༻ҙ͠·͢ɻ NSNotificationKVOΛىͱ͢Δ
AirPlay / Mirroringݕͷ࡞Γํ ࣮ػͰಈ࡞֬ೝͯ͠ϚτϦΫεʹ͠·͢ɻ
AirPlay / Mirroringݕͷ࡞Γํ ϑϥά͕ݕ͍ͨ͠ঢ়ଶʹͳͬͨ࣌ʹॲཧΛ͢Δɻ ྫ: AppleTVʹAirPlayଓ͍ͯ͠Δ࣌GoogleCastϘλϯΛදࣔ͠ͳ͍ɺͳͲɻ
• AirPlayଓத: isAirPlaying:true && isMirroring:false • AirPlay࠶ੜத: AirPlayଓத && isExternalPlaybackActive
• ϛϥʔϦϯάଓத: isMirroring:true usesExternalPlaybackWhileExternalScreenIsActive:falseͷ߹ ͳΜͱ͔ͳΓͦ͏
• AirPlayଓத: isAirPlaying:true && isMirroring:false • AirPlay࠶ੜத: AirPlayଓத && isExternalPlaybackActive
• ϛϥʔϦϯάଓத: isMirroring:true usesExternalPlaybackWhileExternalScreenIsActive:falseͷ߹ ͳΜͱ͔ͳΓͦ͏ ͨͩ͠
AirPlay / Mirroringݕͷҙ ֤ϑϥά͙͢ʹΓସΘΓ·ͤΜɻ ޡݕΛ͙ͨΊɺ࠷0.5ඵఔͭඞཁ͕͋Γ·͢ɻ
AirPlay / Mirroringݕͷ࡞Γํ օ͞Μͥͻ͓͏ͪͰ࡞ͬͯΈͯͶ
͜͜Ͱɺ abema-iosͷࠓճͷରԠʹ͍ͭͯ • ΞϓϦʹAirPlayϘλϯͷ࣮ͳ͔ͬͨɻ • ֎෦ग़ྗ(allowsExternalPlayback)ېࢭ͍ͯ͠ͳ͔ͬͨͨΊɺ ίϯτϩʔϧηϯλʔ͔ΒAirPlay࠶ੜͰ͖ͨɻ • ͱΓ͋͑ͣAirPlayϘλϯ͚ͩग़ͦ͏ɻ
αΫοͱ࣮ ઌ΄Ͳͷϑϥάͷ࣮ʹΑͬͯɺϘλϯͷग़͠Θ ͚tintͷมߋ͕όονϦܾ·͍ͬͯΔɻ
αΫοͱ࣮ ઌ΄Ͳͷϑϥάͷ࣮ʹΑͬͯɺϘλϯͷग़͠Θ ͚tintͷมߋ͕όονϦܾ·͍ͬͯΔɻ LGTM
͝੩ௌ͋Γ͕ͱ͏͟͝ ͍·ͨ͠
͝੩ௌ͋Γ͕ͱ͏͟͝ ͍·ͨ͠ ͋Εʁ
͝੩ௌ͋Γ͕ͱ͏͟͝ ͍·ͨ͠ ࢹௌϩάऔΕͯͳ͘ͳ͍ʁ
͝੩ௌ͋Γ͕ͱ͏͟͝ ͍·ͨ͠ ͦΜͳͣ..
timedMetadataऔΕͳ͍ • AppleTV 4th Gen.(20193݄࣌Ͱ࠷৽ܕ)ͰɺAirPlayதʹ timedMetadata͕औΕͳ͍ɻ • 3rd Gen.ͳΒऔΕΔɻ(ͦΕҎલͷόʔδϣϯະݕূͰෆ໌) •
ʮόά͚ͩͲ͢༧ఆࠓͷͱ͜Ζ͋Γ·ͤΜʯ ࢹௌϩάɺ࠶ੜதͷίϯςϯπλΠτϧͷදࣔɺ൪એCMதͷ ࢹௌ༧ػೳͳͲɺଟ͘ͷػೳ͕timedMetadataґଘɻ
ऴΘͬͨ
ͨͷ͍͠AirPlay جຊฤ͓ΘΓ
Ԡ༻ฤ(͓·͚)
εΫϦʔϯϨίʔσΟϯά • iOS11~ • UIScreen.isCapturedϛϥʔϦϯάͰ Ԡ͢Δʹҙɻ • AirPlay࠶ੜத֎෦σΟεϓϨΠଆ͕ը ͞ΕΔ͜ͱͳ͔ͬͨɻ •
ΞϓϦଆͰ࠶ੜ͞Εͳ͍ͨΊɺAirPlay࠶ ੜதͷըڐՄͯ͠ͳ͍ͣɻ
όοΫάϥϯυ࠶ੜͰAirPlay ܧଓͰ͖Δͷʁ • Ͱ͖·͢ɻ • AVPlayer.usesExternalPlaybackWhileExternalScreenIsA ctive: True ͩͱ͏·͍͔͘ͳ͔ͬͨͨΊҙɻ
FairPlay • DRMͷ߹جຊతʹOSଆͰ֎෦ग़ྗ੍ݶ͞ΕΔɻΞ ϓϦଆ੍ޚ͢Δඞཁ͕ͳ͍͘͠Ͱ͖ͳ͍ɻ • AirPlayͱΓସ͑Δͱ࠶ੜηογϣϯͱͯ͠ผѻ͍ʹͳ Δ༷ͰɺFairPlayͷ༷ͰΩʔͷ࠶औಘ͕࣮ߦ͞ΕΔɻͦ ͷͨΊAirPlayͱ௨ৗ࠶ੜͰckcσʔλʢ෮߸ΩʔʣΛ͍ ճ͢͜ͱෆՄೳɻʢ͍ճͨ͠ͱͯ͠࠶ੜΤϥʔͱͳ Δʣ
FairPlay • AirPlayωοτϫʔΫ͕͋Δલఏͷ ͨΊ͔ɺPersistent Content Key ར༻ෆՄɻ • persistentContentKey͕͑Δલఏ Ͱ࣮͍ͯ͠ΔͱDRMίϯςϯπ
͕࠶ੜΤϥʔʹͳΔͨΊҙɻ
ഒ࠶ੜͱAppleTV Remote • AppleTV Remote͔Βpause=>play͢Δͱ rate:1.0ʹͬͯ͠·͍ɺ࠶ੜ͕ΞϓϦͷ දࣔͱ৯͍ҧ͏ঢ়ଶʹͳΔ • YouTube, dTVΛ֬ೝͨ͠ͱ͜ΖಛʹରԠͯ͠
͓ΒͣɺϢʔβ͕࠶࠶ੜΛઃఆ͢͠ ඞཁ͕͋Δɻ • ͜ͷέʔεΛݕͯ͠࠶rateΛηοτ͢͠ ͜ͱͰղܾͰ͖Δ͕ɺҰॠrate:1.0ͷ··࠶ੜ ͞ΕΔͷճආͰ͖ͳ͍ɻ
AirPlayͨͷ͍͠ • AirPlay != ϛϥʔϦϯά • ϑϥάྨͷཧ͕ҙ֎ͱࡶͳͷͰɺؾΛ͚ͭ·͠ΐ͏ɻ • timedMetadataऔΕ·ͤΜɻ
͓͠·͍
ϝϯόʔ΅͠Ύ͏ • ετϦʔϛϯάΫϥΠΞϯτ • ৴αʔόʔ • ίϯςϯπϚωδϝϯτ • etc.. ͨͷ͍͠՝͕͍ͬͺ͍ʂ