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
97
Swiftコードバトル必勝法
toshi0383
1
200
Sheets API使ってみた
toshi0383
2
250
visionOSについてGlobeeが取り組んでいること
toshi0383
0
430
agile20150512-150512055145-lva1-app6892.pdf
toshi0383
0
120
たのしいAirPlay
toshi0383
1
660
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
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
540
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
430
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
290
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
610
Jakarta EE meets AI
ivargrimstad
0
540
Quine, Polyglot, 良いコード
qnighy
4
640
距離関数を極める! / SESSIONS 2024
gam0022
0
280
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
120
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
220
Featured
See All Featured
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
A better future with KSS
kneath
238
17k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
What's new in Ruby 2.0
geeforr
343
31k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Rails Girls Zürich Keynote
gr2m
94
13k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
10 Git Anti Patterns You Should be Aware of
lemiorhan
654
59k
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