Upgrade to Pro — share decks privately, control downloads, hide ads and more …

AbemaTV iOSのダウンロード再生機能

AbemaTV iOSのダウンロード再生機能

Streaming Conference #2での発表資料です。
https://streaming-lab.connpass.com/event/79586/

E2c86baa99178b8400a2ef49ef861a6c?s=128

toshi0383

April 25, 2018
Tweet

Transcript

  1. AbemaTV iOSͷ μ΢ϯϩʔυ࠶ੜػೳ Streaming Conference #2 Apr 25, 2018 Toshihiro

    Suzuki © Toshihiro Suzuki 2018 1
  2. whoami ͱͬ͠ʔ @toshi0383 AbemaTV iOS / ഑৴ΫϥΠΞϯτ ࢹௌ඼࣭पΓͷR&D CWIP (Certified

    Widevine Implementation Partner) GT SPORT, F1 © Toshihiro Suzuki 2018 2
  3. NABShowߦ͖ͬͯ·ͨ͠ © Toshihiro Suzuki 2018 3

  4. ΞδΣϯμ — AbemaTVͷμ΢ϯϩʔυ࠶ੜػೳͱ͸ — AVAssetDownloadSession֓ཁ — ࣮૷ͷϋϚΓϙΠϯτ͍͔ͭ͘ © Toshihiro Suzuki

    2018 4
  5. AbemaTVͷμ΢ϯϩʔυ࠶ੜػೳͱ͸ — ΦϑϥΠϯ࠶ੜ μ΢ϯϩʔυ࠶ੜ — ࠶ੜ։࢝࣌ʹϝλσʔλऔಘͱDRMͷϥΠηϯεղ ܾͳͲ — μ΢ϯϩʔμͱͯ͠͸AVAssetDownloadSessionΛ࢖ ༻

    — iOS11+ © Toshihiro Suzuki 2018 5
  6. AVAssetDownloadSessionͱ͸ © Toshihiro Suzuki 2018 6

  7. AVAssetDownloadSession֓ཁ1/2 — iOS10+ — URLSessionͷαϒΫϥε — ෳ਺ͷAVAssetDownloadTaskΛ؅ཧ — Session୯ҐͰWi-FiͷΈڐՄ͔Ͳ͏͔ࢦఆՄೳ —

    όοΫάϥ΢ϯυDLʹ΋ରԠ © Toshihiro Suzuki 2018 7
  8. AVAssetDownloadSession֓ཁ2/2 — جຊతʹ͸λεΫ͸ฒྻʹ૸Δ — Playback while downloading͕͍͍ײ͡Ͱ͋Δ — DLΞηοτ͸ඞཁʹԠͯࣗ͡ಈͰύʔδ͞ΕΔ —

    [iOS11] AVAssetDownloadStorageManagementPolicy Ͱॏཁ౓ΛઃఆՄೳ © Toshihiro Suzuki 2018 8
  9. AbemaTVಛ༗ͷ੍ޚ — 25੍݅ݶ — FGͰ͸ॱ൪ʹDL͞ΕΔΑ͏ʹsuspend/resume => Ϣʔβ͸͖ͬͱݟ͍ͨॱ൪ʹDL͢Δʹҧ͍ͳ͍ — ࠷ߴը࣭͸DLͤͯ͞ͳ͍ master

    playlistΛύʔεͯ͠720p/480pͷplaylistͲͪ Β͔ΛDL © Toshihiro Suzuki 2018 9
  10. ౰ॳͷ༧૝ © Toshihiro Suzuki 2018 10

  11. Android͸μ΢ϯϩʔμΛϑϧεΫϥον iOS͸SDKͰΠʔδʔϞʔυ iOS͸1ϲ݄͘Β͍ૣ͘ऴΘΔͬ͠ΐ © Toshihiro Suzuki 2018 11

  12. ݁Ռ Android͸μ΢ϯϩʔμΛϑϧεΫϥονͯ͠Δ͏ͪʹ ExoPlayerʹμ΢ϯϩʔμ࣮૷͞ΕͨΒ݁͘͠ہͦͬͪ Λ࠾༻ ʹ΋ؔΘΒͣiOS͸Androidͱಉ͘͡Β͍Ͱண஍ɻ © Toshihiro Suzuki 2018 12

  13. Ͳ͏ͯ͜͠͏ͳͬͨ — ઌʹ࣮૷͕ਐΉͱ࢓༷ΛܾΊͳ͕ΒʹͳΔͷͰ଎౓ ͕མͪΔ — AVFoundation͕ϒϥοΫϘοΫε ҙਤ௨Γಈ͔ͳ͍৔߹ʹσόοά͕೉ߤ͕ͪ͠ © Toshihiro Suzuki

    2018 13
  14. ϋϚΓϙΠϯτ © Toshihiro Suzuki 2018 14

  15. [ϋϚΓϙΠϯτͦͷ0] URLSessionConfigurationͷύϥϝʔλ͸ػೳ͠ͳ͍΋ ͘͠͸۩ମతͳڍಈ͕ෆ໌֬΋ͷ͕΄ͱΜͲ - timeoutIntervalForResource ... ࣮ࡍʹtimeout௒͑ͯ ΋࡟আ͞ΕΔ͜ͱ͸ͳ͔ͬͨ - httpMaximumConnectionsPerHost

    ... ػೳ͠ͳ͍ © Toshihiro Suzuki 2018 15
  16. [ϋϚΓϙΠϯτͦͷ1] 403ʹͳͬͨ৔߹ɺλεΫ͕runningͷ··Ԡ౴͠ͳ͘ ͳΔ μ΢ϯϩʔμͱͯ͠ݫີʹڍಈΛ୲อ͢Δʹ͸ɺࣄલʹ HEADϦΫΤετ͢ΔͳͲରԠ͕ඞཁͦ͏ © Toshihiro Suzuki 2018 16

  17. [ϋϚΓϙΠϯτͦͷ2] assetTitle໰୊ assetTitleʹಛఆͷจࣈΛࢦఆ͢Δͱtask͕Τϥʔʹ ͳΔorਐ·ͳ͍ # όάϨϙࡁΈ © Toshihiro Suzuki 2018

    17
  18. [ϋϚΓϙΠϯτͦͷ3] ΞϓϦΩϧ໰୊ DLதʹΞϓϦΩϧ͢Δͱtask͕Ωϟϯηϧ͞ΕΔ. ෮ݩ ͸ෆՄೳ. © Toshihiro Suzuki 2018 18

  19. [ϋϚΓϙΠϯτͦͷ3] ΞϓϦΩϧ໰୊ Apple: ʮΞϓϦΩϧͨͬͯ͜͠ͱ͸ɺλεΫΩϟϯη ϧ͍ͨͬͯ͜͠ͱͬ͠ΐʯ https://developer.apple.com/library/content/ documentation/iPhone/Conceptual/ iPhoneOSProgrammingGuide/BackgroundExecution/ BackgroundExecution.html #

    όάϨϙࡁΈ © Toshihiro Suzuki 2018 19
  20. [ϋϚΓϙΠϯτͦͷ4] iOS10໰୊ iOS10ͷΈɺಛఆͷίϯςϯπͰDL͕100%ࣦഊ͢Δ ੾Γ෼͚͢Δ͕࣌ؒ໪ମແ͍ͷͰiOS10ରԠࣗମݟૹΔ ͜ͱʹ © Toshihiro Suzuki 2018 20

  21. ໰୊ࢁੵ ͍ͬͦεΫϥον͢Δํ͕ɻɻ — AVPlayer͕ϩʔΧϧύεΛड͚෇͚ͯ͘Εͳ͍ͨΊ ϫʔΫΞϥ΢ϯυ͕ඞཁ ͳͲͷ՝୊ ࠓճ͸ରԠݟૹΓ © Toshihiro Suzuki

    2018 21
  22. ·ͱΊ — AVAssetDownloadSession͸OSͷαϙʔτ͕ड͚ΒΕ ͯศར — ඞͣ͠΋ΠʔδʔϞʔυͰ͸ͳ͍͔΋ © Toshihiro Suzuki 2018

    22
  23. ืू Ұॹʹಇ͘஥ؒΛืू͍ͯ͠·͢ Χʔτ஥ؒ΋ืू͍ͯ͠·͢ © Toshihiro Suzuki 2018 23

  24. End ! © Toshihiro Suzuki 2018 24

  25. Toshihiro Suzuki Twitter: @toshi0383 GitHub: @toshi0383 Qiita: @toshi0383 Email: t.suzuki326@gmail.com

    © Toshihiro Suzuki 2018 25