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
CSC509 Lecture 09
javiergs
PRO
0
110
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
0
160
[PyCon Korea 2024 Keynote] 커뮤니티와 파이썬, 그리고 우리
beomi
0
110
外部システム連携先が10を超えるシステムでのアーキテクチャ設計・実装事例
kiwasaki
1
230
Sidekiqで実現する 長時間非同期処理の中断と再開 / Pausing and Resuming Long-Running Asynchronous Jobs with Sidekiq
hypermkt
6
2.7k
Vue SFCのtemplateでTypeScriptの型を活用しよう
tsukkee
3
1.5k
Go言語でターミナルフレンドリーなAIコマンド、afaを作った/fukuokago20_afa
monochromegane
2
140
Hotwire or React? ~Reactの録画機能をHotwireに置き換えて得られた知見~ / hotwire_or_react
harunatsujita
9
4.1k
約9000個の自動テストの 時間を50分->10分に短縮 Flakyテストを1%以下に抑えた話
hatsu38
23
11k
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
430
Amazon Neptuneで始めてみるグラフDB-OpenSearchによるグラフの全文検索-
satoshi256kbyte
4
330
Outline View in SwiftUI
1024jp
1
160
Featured
See All Featured
For a Future-Friendly Web
brad_frost
175
9.4k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
355
29k
How GitHub (no longer) Works
holman
311
140k
How to Think Like a Performance Engineer
csswizardry
19
1.1k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
The Invisible Side of Design
smashingmag
297
50k
Building Applications with DynamoDB
mza
90
6.1k
The Pragmatic Product Professional
lauravandoore
31
6.3k
What's new in Ruby 2.0
geeforr
342
31k
StorybookのUI Testing Handbookを読んだ
zakiyama
26
5.2k
Building Adaptive Systems
keathley
38
2.2k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
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