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
Less waste, more joy, and a lot more green: How Quarkus makes Java better
hollycummins
0
100
Figma Dev Modeで変わる!Flutterの開発体験
watanave
0
150
レガシーシステムにどう立ち向かうか 複雑さと理想と現実/vs-legacy
suzukihoge
14
2.2k
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
Remix on Hono on Cloudflare Workers
yusukebe
1
300
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
240
CSC509 Lecture 13
javiergs
PRO
0
110
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
300
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
Jakarta EE meets AI
ivargrimstad
0
620
Micro Frontends Unmasked Opportunities, Challenges, Alternatives
manfredsteyer
PRO
0
110
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.2k
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
Designing for humans not robots
tammielis
250
25k
Happy Clients
brianwarren
98
6.7k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Automating Front-end Workflow
addyosmani
1366
200k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
Facilitating Awesome Meetings
lara
50
6.1k
Scaling GitHub
holman
458
140k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
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.. ͨͷ͍͠՝͕͍ͬͺ͍ʂ