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
CSC305 Lecture 13
javiergs
PRO
0
130
弊社の「意識チョット低いアーキテクチャ」10選
texmeijin
5
23k
Progressive Web Apps für Desktop und Mobile mit Angular (Hands-on)
christianliebel
PRO
0
110
Android 15 でアクションバー表示時にステータスバーが白くなってしまう問題
tonionagauzzi
0
140
シールドクラスをはじめよう / Getting Started with Sealed Classes
mackey0225
3
400
外部システム連携先が10を超えるシステムでのアーキテクチャ設計・実装事例
kiwasaki
1
230
現場で役立つモデリング 超入門
masuda220
PRO
13
2.9k
Identifying User Idenity
moro
6
7.9k
CPython 인터프리터 구조 파헤치기 - PyCon Korea 24
kennethanceyer
0
250
From Subtype Polymorphism To Typeclass-based Ad hoc Polymorphism- An Example
philipschwarz
PRO
0
170
ピラミッド、アイスクリームコーン、SMURF: 自動テストの最適バランスを求めて / Pyramid Ice-Cream-Cone and SMURF
twada
PRO
9
1k
色々なIaCツールを実際に触って比較してみる
iriikeita
0
270
Featured
See All Featured
Docker and Python
trallard
40
3.1k
The Cult of Friendly URLs
andyhume
78
6k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
107
49k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Building an army of robots
kneath
302
42k
Building Your Own Lightsaber
phodgson
102
6.1k
A better future with KSS
kneath
238
17k
Navigating Team Friction
lara
183
14k
GraphQLとの向き合い方2022年版
quramy
43
13k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
Making the Leap to Tech Lead
cromwellryan
132
8.9k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
43
6.6k
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.. ͨͷ͍͠՝͕͍ͬͺ͍ʂ