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
640
たのしい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
Swiftコードバトル必勝法
toshi0383
0
180
Sheets API使ってみた
toshi0383
2
240
visionOSについてGlobeeが取り組んでいること
toshi0383
0
410
agile20150512-150512055145-lva1-app6892.pdf
toshi0383
0
110
Profiling using Signpost
toshi0383
2
860
AVPlayer周りの設計tips
toshi0383
6
800
cmdshelf::from("Swift")
toshi0383
3
820
AbemaTV iOSのダウンロード再生機能
toshi0383
4
930
tvOSのリスト系のインデックスラベルを自作してみる
toshi0383
0
590
Other Decks in Programming
See All in Programming
Cohesion in Modeling and Design
mploed
3
180
M5Stackボードの選び方
tanakamasayuki
0
200
Progressive Web Apps for Rails developers
siaw23
2
530
Rails 8 Frontend: 10 commandments & 7 deadly sins in 2025
yshmarov
1
610
Beyond the RuboCop Defaults
koic
2
500
XP2024 っていう国際会議に行ってきたよの記 / XP2024 Conference Report
bonotake
4
190
データサイエンスのフルサイクル開発を実現する機械学習パイプライン
xcnkx
2
480
Kubernetes上でOracle_Databaseの運用を楽にするOraOperatorの紹介
nnaka2992
0
150
実践Dash - 手を抜きながら本気で作るデータApplicationの基本と応用 / Dash for Python and Baseball
shinyorke
2
230
GitHub Copilot Workspace で我々のアプリ開発がどう変わるのか?
shuyakinjo
0
870
[KR] Server Driven Compose With Firebase
skydoves
2
160
CDKを活用した 大規模コンテナ移行 プロジェクトの紹介
yoyoyopg
0
240
Featured
See All Featured
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
44
2k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
125
18k
Scaling GitHub
holman
458
140k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
225
22k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
1
250
It's Worth the Effort
3n
183
27k
How To Stay Up To Date on Web Technology
chriscoyier
786
250k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
158
15k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
How GitHub (no longer) Works
holman
311
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.. ͨͷ͍͠՝͕͍ͬͺ͍ʂ