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
AbemaTV iOSのダウンロード再生機能
Search
toshi0383
April 25, 2018
Programming
4
940
AbemaTV iOSのダウンロード再生機能
Streaming Conference #2での発表資料です。
https://streaming-lab.connpass.com/event/79586/
toshi0383
April 25, 2018
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
たのしいAirPlay
toshi0383
1
650
Profiling using Signpost
toshi0383
2
870
AVPlayer周りの設計tips
toshi0383
6
810
cmdshelf::from("Swift")
toshi0383
3
830
Other Decks in Programming
See All in Programming
[PyCon Korea 2024 Keynote] 커뮤니티와 파이썬, 그리고 우리
beomi
0
110
Boost Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
880
ECSのサービス間通信 4つの方法を比較する 〜Canary,Blue/Greenも添えて〜
tkikuc
11
2.3k
OpenTelemetryでRailsのパフォーマンス分析を始めてみよう(KoR2024)
ymtdzzz
4
1.6k
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
150
カスタムしながら理解するGraphQL Connection
yanagii
1
1.2k
PagerDuty を軸にした On-Call 構築と運用課題の解決 / PagerDuty Japan Community Meetup 4
horimislime
1
110
Vue SFCのtemplateでTypeScriptの型を活用しよう
tsukkee
3
1.5k
レガシーな Android アプリのリアーキテクチャ戦略
oidy
1
170
PLoP 2024: The evolution of the microservice architecture pattern language
cer
PRO
0
1.7k
Jakarta Concurrencyによる並行処理プログラミングの始め方 (JJUG CCC 2024 Fall)
tnagao7
1
230
【Kaigi on Rails 2024】YOUTRUST スポンサーLT
krpk1900
1
250
Featured
See All Featured
Agile that works and the tools we love
rasmusluckow
327
21k
Writing Fast Ruby
sferik
626
61k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
3
370
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
StorybookのUI Testing Handbookを読んだ
zakiyama
26
5.2k
Docker and Python
trallard
40
3.1k
Done Done
chrislema
181
16k
Optimizing for Happiness
mojombo
376
69k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
328
21k
Embracing the Ebb and Flow
colly
84
4.4k
Facilitating Awesome Meetings
lara
49
6k
Transcript
AbemaTV iOSͷ μϯϩʔυ࠶ੜػೳ Streaming Conference #2 Apr 25, 2018 Toshihiro
Suzuki © Toshihiro Suzuki 2018 1
whoami ͱͬ͠ʔ @toshi0383 AbemaTV iOS / ৴ΫϥΠΞϯτ ࢹௌ࣭पΓͷR&D CWIP (Certified
Widevine Implementation Partner) GT SPORT, F1 © Toshihiro Suzuki 2018 2
NABShowߦ͖ͬͯ·ͨ͠ © Toshihiro Suzuki 2018 3
ΞδΣϯμ — AbemaTVͷμϯϩʔυ࠶ੜػೳͱ — AVAssetDownloadSession֓ཁ — ࣮ͷϋϚΓϙΠϯτ͍͔ͭ͘ © Toshihiro Suzuki
2018 4
AbemaTVͷμϯϩʔυ࠶ੜػೳͱ — ΦϑϥΠϯ࠶ੜ μϯϩʔυ࠶ੜ — ࠶ੜ։࢝࣌ʹϝλσʔλऔಘͱDRMͷϥΠηϯεղ ܾͳͲ — μϯϩʔμͱͯ͠AVAssetDownloadSessionΛ ༻
— iOS11+ © Toshihiro Suzuki 2018 5
AVAssetDownloadSessionͱ © Toshihiro Suzuki 2018 6
AVAssetDownloadSession֓ཁ1/2 — iOS10+ — URLSessionͷαϒΫϥε — ෳͷAVAssetDownloadTaskΛཧ — Session୯ҐͰWi-FiͷΈڐՄ͔Ͳ͏͔ࢦఆՄೳ —
όοΫάϥϯυDLʹରԠ © Toshihiro Suzuki 2018 7
AVAssetDownloadSession֓ཁ2/2 — جຊతʹλεΫฒྻʹΔ — Playback while downloading͕͍͍ײ͡Ͱ͋Δ — DLΞηοτඞཁʹԠͯࣗ͡ಈͰύʔδ͞ΕΔ —
[iOS11] AVAssetDownloadStorageManagementPolicy ͰॏཁΛઃఆՄೳ © Toshihiro Suzuki 2018 8
AbemaTVಛ༗ͷ੍ޚ — 25੍݅ݶ — FGͰॱ൪ʹDL͞ΕΔΑ͏ʹsuspend/resume => Ϣʔβ͖ͬͱݟ͍ͨॱ൪ʹDL͢Δʹҧ͍ͳ͍ — ࠷ߴը࣭DLͤͯ͞ͳ͍ master
playlistΛύʔεͯ͠720p/480pͷplaylistͲͪ Β͔ΛDL © Toshihiro Suzuki 2018 9
ॳͷ༧ © Toshihiro Suzuki 2018 10
AndroidμϯϩʔμΛϑϧεΫϥον iOSSDKͰΠʔδʔϞʔυ iOS1ϲ݄͘Β͍ૣ͘ऴΘΔͬ͠ΐ © Toshihiro Suzuki 2018 11
݁Ռ AndroidμϯϩʔμΛϑϧεΫϥονͯ͠Δ͏ͪʹ ExoPlayerʹμϯϩʔμ࣮͞ΕͨΒ݁͘͠ہͦͬͪ Λ࠾༻ ʹؔΘΒͣiOSAndroidͱಉ͘͡Β͍Ͱணɻ © Toshihiro Suzuki 2018 12
Ͳ͏ͯ͜͠͏ͳͬͨ — ઌʹ࣮͕ਐΉͱ༷ΛܾΊͳ͕ΒʹͳΔͷͰ ͕མͪΔ — AVFoundation͕ϒϥοΫϘοΫε ҙਤ௨Γಈ͔ͳ͍߹ʹσόοά͕ߤ͕ͪ͠ © Toshihiro Suzuki
2018 13
ϋϚΓϙΠϯτ © Toshihiro Suzuki 2018 14
[ϋϚΓϙΠϯτͦͷ0] URLSessionConfigurationͷύϥϝʔλػೳ͠ͳ͍ ͘͠۩ମతͳڍಈ͕ෆ໌֬ͷ͕΄ͱΜͲ - timeoutIntervalForResource ... ࣮ࡍʹtimeout͑ͯ আ͞ΕΔ͜ͱͳ͔ͬͨ - httpMaximumConnectionsPerHost
... ػೳ͠ͳ͍ © Toshihiro Suzuki 2018 15
[ϋϚΓϙΠϯτͦͷ1] 403ʹͳͬͨ߹ɺλεΫ͕runningͷ··Ԡ͠ͳ͘ ͳΔ μϯϩʔμͱͯ͠ݫີʹڍಈΛ୲อ͢Δʹɺࣄલʹ HEADϦΫΤετ͢ΔͳͲରԠ͕ඞཁͦ͏ © Toshihiro Suzuki 2018 16
[ϋϚΓϙΠϯτͦͷ2] assetTitle assetTitleʹಛఆͷจࣈΛࢦఆ͢Δͱtask͕Τϥʔʹ ͳΔorਐ·ͳ͍ # όάϨϙࡁΈ © Toshihiro Suzuki 2018
17
[ϋϚΓϙΠϯτͦͷ3] ΞϓϦΩϧ DLதʹΞϓϦΩϧ͢Δͱtask͕Ωϟϯηϧ͞ΕΔ. ෮ݩ ෆՄೳ. © Toshihiro Suzuki 2018 18
[ϋϚΓϙΠϯτͦͷ3] ΞϓϦΩϧ Apple: ʮΞϓϦΩϧͨͬͯ͜͠ͱɺλεΫΩϟϯη ϧ͍ͨͬͯ͜͠ͱͬ͠ΐʯ https://developer.apple.com/library/content/ documentation/iPhone/Conceptual/ iPhoneOSProgrammingGuide/BackgroundExecution/ BackgroundExecution.html #
όάϨϙࡁΈ © Toshihiro Suzuki 2018 19
[ϋϚΓϙΠϯτͦͷ4] iOS10 iOS10ͷΈɺಛఆͷίϯςϯπͰDL͕100%ࣦഊ͢Δ Γ͚͢Δ͕࣌ؒମແ͍ͷͰiOS10ରԠࣗମݟૹΔ ͜ͱʹ © Toshihiro Suzuki 2018 20
ࢁੵ ͍ͬͦεΫϥον͢Δํ͕ɻɻ — AVPlayer͕ϩʔΧϧύεΛड͚͚ͯ͘Εͳ͍ͨΊ ϫʔΫΞϥϯυ͕ඞཁ ͳͲͷ՝ ࠓճରԠݟૹΓ © Toshihiro Suzuki
2018 21
·ͱΊ — AVAssetDownloadSessionOSͷαϙʔτ͕ड͚ΒΕ ͯศར — ඞͣ͠ΠʔδʔϞʔυͰͳ͍͔ © Toshihiro Suzuki 2018
22
ืू Ұॹʹಇؒ͘Λืू͍ͯ͠·͢ Χʔτؒืू͍ͯ͠·͢ © Toshihiro Suzuki 2018 23
End ! © Toshihiro Suzuki 2018 24
Toshihiro Suzuki Twitter: @toshi0383 GitHub: @toshi0383 Qiita: @toshi0383 Email:
[email protected]
© Toshihiro Suzuki 2018 25