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
650
たのしい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
94
Swiftコードバトル必勝法
toshi0383
1
200
Sheets API使ってみた
toshi0383
2
250
visionOSについてGlobeeが取り組んでいること
toshi0383
0
420
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
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
150
go.mod、DockerfileやCI設定に分散しがちなGoのバージョンをまとめて管理する / Go Connect #3
arthur1
10
2.4k
讓數據說話:用 Python、Prometheus 和 Grafana 講故事
eddie
0
350
WEBエンジニア向けAI活用入門
sutetotanuki
0
300
Vue3の一歩踏み込んだパフォーマンスチューニング2024
hal_spidernight
3
3.1k
Tuning GraphQL on Rails
pyama86
2
1k
Realtime API 入門
riofujimon
0
110
Pinia Colada が実現するスマートな非同期処理
naokihaba
2
160
Boost Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
880
開発効率向上のためのリファクタリングの一歩目の選択肢 ~コード分割~ / JJUG CCC 2024 Fall
ryounasso
0
370
CSC305 Lecture 13
javiergs
PRO
0
130
/←このスケジュール表に立ち向かう フロントエンド開発戦略 / A front-end development strategy to tackle a single-slash schedule.
nrslib
1
590
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
290
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.6k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
664
120k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Designing Experiences People Love
moore
138
23k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
32
1.8k
Fireside Chat
paigeccino
32
3k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
27
1.9k
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.. ͨͷ͍͠՝͕͍ͬͺ͍ʂ