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

検証 SharePlay media playback

検証 SharePlay media playback

発表イベント : CA.swift #15 WWDC21報告会
https://cyberagent.connpass.com/event/215215/

WWDC21で発表されたSharePlayを実際に試してみました。

Chiharu Nameki

June 14, 2021
Tweet

More Decks by Chiharu Nameki

Other Decks in Technology

Transcript

  1. ݕূ SharePlay media playback
    2021/07/14


    ߦ໦ ઍय़ Streaming Client Team, גࣜձࣾAbemaTV


    @Ridwy
    CA.swift #15 WWDC21ใࠂձ
    ※ ެ։༻ʹൃද࣌ͷεϥΠυ͔ΒЌ൛OSͷεΫϦʔϯγϣοτ΍ಈըΛऔΓআ͍ͨΓ΅͔ͨ͠Γͨ͠όʔδϣϯͰ͢ɻΠϕϯτࢀՃऀͷํ͸ݶఆެ։ͷURL͔ΒൃදಈըΛ͝ཡʹͳΕ·͢ͷͰ߹Θͤͯ͝׆༻͍ͩ͘͞ɻ

    View full-size slide

  2. SharePlayͱ͸
    • FaceTime௨࿩தʹ཭Εͨ૬खͱ
    ಉ͡ମݧΛڞ༗Ͱ͖Δػೳ


    • ಈըɾԻָɾΞϓϦಠࣗͷମݧ

    • iOS 15, tvOS 15, macOS 12Ҏ߱


    • Safari 15Ҏ߱
    shareplay SF symbol

    View full-size slide

  3. Social-Viewing
    Co-Viewing
    Ո଒΍༑ਓͰөը΍εϙʔπ؍ઓͳͲΛָ͠Ήମݧ
    ཭Ε͍ͯͯ΋Ұॹʂ
    SharePlay͸͜ΕΛFaceTime্Ͱ࣮ݱ͢Δ

    View full-size slide

  4. SharePlay media playback


    IS NOT


    ࠶഑৴

    ίϯςϯπࣗମ͸͜Ε·Ͱ௨Γ֤αʔϏεͷ࢓૊ΈͰ഑৴


    ࠶ੜλΠϛϯάΛίϯτϩʔϧ

    View full-size slide

  5. GroupActivities API

    View full-size slide

  6. GroupActivities API
    FaceTime։࢝ʂ
    FaceTime௨࿩

    View full-size slide

  7. GroupActivity


    ڞ༗͢Δମݧ
    GroupActivities API
    ࡞੒
    FaceTime௨࿩

    View full-size slide

  8. GroupActivity


    ڞ༗͢Δମݧ
    GroupActivities API
    activate()
    FaceTime௨࿩

    View full-size slide

  9. GroupActivity


    ڞ༗͢Δମݧ
    GroupActivities API
    GroupSession
    FaceTime௨࿩

    View full-size slide

  10. GroupActivity


    ڞ༗͢Δମݧ
    GroupActivities API
    GroupSession
    FaceTime௨࿩
    join() join() join()

    View full-size slide

  11. ࠶ੜλΠϛϯάͷಉظ
    AVPlaybackCoordinator
    Appleެࣜαϯϓϧίʔυ Supporting Coordinated Media Playback ͷυΩϡϝϯτΑΓ
    GroupSessionΛ௨ͯ͡
    Coordinator͕࠶ੜɾఀࢭɾγʔΫ
    ͳͲͷΠϕϯτΛ΍ΓͱΓ

    View full-size slide

  12. ͬ͘͟Γݴ͏ͱ


    શһͷ࠶ੜ४උ͕ग़དྷͨΒ


    ʮͤʔͷʂʯͰ։࢝͢Δ
    ࠶ੜλΠϛϯάͷಉظ
    AVPlaybackCoordinator

    View full-size slide

  13. ͬ͘͟Γݴ͏ͱ


    શһͷ࠶ੜ४උ͕ग़དྷͨΒ


    ʮͤʔͷʂʯͰ։࢝͢Δ
    AVPlaybackCoordinator
    ࠶ੜλΠϛϯάͷಉظ

    View full-size slide

  14. HTTP Live StreamingΛಉظ͢Δʹ͸
    AVPlaybackCoordinator
    ϓϨΠϦετʹEXT-X-PROGRAM-DATE-TIMEλάΛهड़


    #EXT-X-PROGRAM-DATE-TIME:

    ࣍ͷηάϝϯτͷઌ಄Λઈର࣌ࠁͱ݁ͼ͚ͭΔ

    View full-size slide

  15. struct Movie: Hashable, Codable {


    var url: URL


    var title: String


    }


    struct WatchingActivity: GroupActivity {


    let movie: Movie




    var metadata: GroupActivityMetadata {


    var metadata = GroupActivityMetadata()


    metadata.type = .watchTogether


    metadata.fallbackURL = movie.url


    metadata.title = movie.title


    return metadata


    }


    }
    ActivityΛఆٛ
    GroupActivityϓϩτίϧʹ४ڌͤ͞Δ

    GroupActivity͸CodableΛܧঝ

    activate࣌ʹencode, decodeͯ͠

    ࢀՃऀʹಧ͚ΒΕΔ
    ϝλσʔλ͸ΧʔυͳͲʹදࣔ͞ΕΔ

    SafariͰ͸fallbackURL͕։͔ΕΔ

    ଞʹ͸.listenTogether, .generic͕͋Δ

    View full-size slide

  16. ࠶ੜϘλϯͷॲཧ
    let activity = WatchingActivity(movie: movie)




    switch await activity.prepareForActivation() {


    case .activationDisabled:


    // SharePlayՄೳͰͳ͍৔߹͸͙͢͜͜ʹདྷΔ


    case .activationPreferred:


    activity.activate()




    case .cancelled:


    break



    default: ()


    }

    View full-size slide

  17. Sessionͷ։࢝Λ؂ࢹͯ͠Join
    for await session in WatchingActivity.sessions() {
    // ࠶ੜUIͷηοτΞοϓΛߦ͏




    // CoordinatorΛSessionʹ݁ͼ͚ͭΔ
    player.playbackCoordinator.coordinateWithSession(session)


    session.join()
    }
    ಉظͷͨΊͷίʔυ͸͜Ε͚ͩ

    View full-size slide

  18. ΞϓϦಠࣗͷମݧΛγΣΞ͢Δ৔߹
    GroupSessionMessenger
    • ΍ΓͱΓ͢ΔΠϕϯτΛఆٛ


    • GroupSessionMessengerΛར༻ͯ͠SessionʹΠϕϯτΛpost

    View full-size slide

  19. ରԠ༧ఆͷαʔϏε
    WWDC21 KeynoteΑΓ

    View full-size slide

  20. ͍Ζ͍Ζࢼͯ͠Έ·͠ΐ͏

    View full-size slide

  21. ΞϓϦΛ͍࣋ͬͯͳ͔ͬͨΒʁ
    • ࢀՃϘλϯ͕App Store΁ͷಋઢʹͳΔ


    • ༑ୡ͕଴͍ͬͯΔͷͰͰ͖Δ͚ͩૣ͘ࢹௌͰ͖ΔΑ͏ʹUXΛઃܭ

    View full-size slide

  22. ඇରԠσόΠε(iOS 15ະຬͷiPhoneͳͲ)


    ͷϝϯόʔ͕͍ͨΒʁ
    • ରԠσόΠεؒͰSharePlay͕Մೳ


    • ඇରԠσόΠεͰ͸ͳʹ΋ى͖ͳ͍
    iOS 15 β2Ͱݕূ
    iOS 14.6
    iOS 15


    FaceTime͠ͳ͕ΒSharePlayͰಈըࢹௌத

    View full-size slide

  23. ࣈນ΍Ի੠͸ʁ
    • ͋͘·Ͱௐ੔͞ΕΔͷ͸࠶ੜλΠ
    ϛϯά


    • ֤͕ࣗͦΕͧΕ͖͢ͳࣈນ΍Ի੠
    Λબ୒Մೳ
    υʔφοπͷ݀ʹ͍ͭͯ
    About donut hole

    View full-size slide

  24. ޿ࠂ͋Γɾͳ͠ͷϓϥϯͷϢʔβ


    ͕ࠞࡏ͍ͯͨ͠ΒͲ͏͢Δ΂͖ʁ
    • ύʔιφϥΠζ͞Εͨ޿ࠂ͸ϝ
    ΠϯͷίϯςϯπͷಉظʹӨڹ
    ͠ͳ͍Α͏ʹผͷϓϨΠϠʔͰ
    ࠶ੜ


    • ޿ࠂ͕ऴΘͬͨΒ࠶߹ྲྀ


    • AVPlayerInterstitialEvent API
    (iOS 15+)͕ར༻Մೳ
    Ad
    ޿ࠂ͋Γ
    ޿ࠂͳ͠

    View full-size slide

  25. ಉظͷਫ਼౓͸ʁ
    • ίϯτϩʔϧΠϕϯτͷ΍ΓͱΓʹ͸ؾʹͳΔ΄Ͳͷ஗Ԇ͸ͳ͍

    ʢϦϦʔεޙͲ͏͔ʁʣ


    • ίϯςϯπͷಉظͷਫ਼౓͸αʔϏεͷ࣮૷ʹΑΔ

    • ݕূ࣌͸TVΞϓϦͰ਺ϑϨʔϜʙ਺ඵͷζϨ͕ݟΒΕͨ
    iOS 15 β2Ͱݕূ

    View full-size slide

  26. ࢀߟηογϣϯ
    WWDC21, Apple
    • Keynote 0:09:40


    • Platforms State of the Union 1:05:44


    • Meet Group Activities


    • Design for Group Activities


    • Coordinate media experiences with Group Activities


    • Build custom experiences with Group Activities


    • Coordinate media playback in Safari with Group Activities

    View full-size slide

  27. AppleެࣜϦιʔε
    • Human Interface Guidelines


    SharePlayͷষ͕௥Ճ͞Ε͍ͯΔ


    • αϯϓϧίʔυ


    • Supporting Coordinated Media Playback


    • API ϦϑΝϨϯε


    • GroupActivities


    • AVPlaybackCoordinator

    View full-size slide

  28. ॴײ
    • ͱΓ͋͑ͣ૊ΈࠐΈ͚ͩͳΒطଘ࣮૷Λେ͖͘ม͑Δ͜ͱͳ͘Մೳ


    • SharePlayΛػʹΠϯετʔϧͯ͘͠ΕͨϢʔβ͕εϜʔζʹࢹௌ։࢝Ͱ͖Δ
    ྲྀΕΛߟ͑Δඞཁ͕͋Δ


    • ޿ࠂͷѻ͍͕೉ͦ͠͏


    • Picture-in-Pictureʹ΋ରԠ͢Δͱମݧͱͯ͠ͱͯ΋ྑ͍

    View full-size slide

  29. Slides for Ice-breaking
    ͓·͚

    View full-size slide

  30. WWDC21
    • ڈ೥ʹҾ͖ଓ͖ΦϯϥΠϯ


    • ॳ೔͸KeynoteͱPlatform State of the Union


    • 2೔໨Ҏ߱͸ຖ೔ηογϣϯಈը͕ެ։͞Ε͍ͯ͘ʢ४උग़དྷ࣍ୈʁʣ


    • 2೔໨ͷேͷஶ໊ਓΛݺΜͰߦΘΕΔεϖγϟϧΠϕϯτ͸݈ࡏ


    • ࠓ೥͸NASAͰՐ੕ʹߦ͘ϩέοτͷઃܭΛ͞Ε͍ͯΔঁੑٕज़ऀ Tiera Fletcher͞Μʢ·ͩ
    ެ։தʂʣ


    • 1 on 1ͷϥϘͷଞɺCoding Challenge΍ForumΛ࢖ͬͨऔΓ૊Έ΋


    • εϥΠυ͕ެ։͞Εͳ͘ͳͬͯ͠·͍·͕ͨ͠ɺ͔ΘΓʹTranscript͕ศར


    • ΦϯϥΠϯͷԸܙͰηογϣϯͷ௕͕͞ϑϨΩγϒϧʹͳΓɺখ͞ΊͷτϐοΫ͕௥͍΍͘͢
    June 7-11

    View full-size slide

  31. ಈըStreamingؔ࿈ͷτϐοΫε΋


    ଟ͋͘Γ·ͨ͠

    View full-size slide

  32. HLS Interstitials
    • ޿ࠂΛಠཱͨ͠Ξηοτͱͯ͠ѻ͏


    • Ͳͷ޿ࠂΛදࣔ͢Δ͔μΠφϛοΫʹมߋՄೳʢlate bindingʣ


    • ൪૊ͷ೚ҙͷҐஔʹ޿ࠂΛεέδϡʔϧՄೳ

    DISCONTINUITYλάͷΑ͏ʹηάϝϯτͰ੾Δඞཁ͕ͳ͍


    • AirPlay, Picture in Picture΋αϙʔτ

    ैདྷͷCSAIͰ͸ࠔ೉
    #EXT-X-DATERANGE:ID="ad1",CLASS="com.apple.hls.interstitial",


    START-DATE="2020-01-02T21:55:44.000Z",DURATION=15.0,


    X-ASSET-URI="http://example.com/ad1.m3u8",


    X-RESUME-OFFSET=0,X-RESTRICT="SKIP,JUMP"
    ϓϨΠϦετ΁ͷૠೖྫ (#EXT-X-ENDLIST ͷޙͳͲ)

    View full-size slide

  33. HLS Content Steering
    • CDNͷෛՙ෼ࢄͷٕज़


    • εςΞϦϯάαʔόͰCDNͷ༏ઌॱҐͷϦετʢಈతʹมಈ͢ΔʣΛఏڙ


    • ಛఆͷCDNͰٸͳΞΫηε૿΍ωοτϫʔΫো֐͕ൃੜͨ࣌͠ɺεςΞϦϯ
    άαʔόͰฦ͢Steering ManifestΛௐ੔ͯ͠৽ن΋͘͠͸༨༟ͷ͋ΔCDNʹ
    ΫϥΠΞϯτΛ༠ಋ͢Δ
    #EXTM3U


    #EXT-X-CONTENT-STEERING:SERVER-URI="/steering?video=00012",PATHWAY-ID="CN"


    #EXT-X-STREAM-INF:BANDWIDTH=1280000,CODECS="avc1.640028",PATHWAY-ID="CN"


    https://cn.example.com/low/audio-video.m3u8


    #EXT-X-STREAM-INF:BANDWIDTH=7680000,CODECS="avc1.640028",PATHWAY-ID="CN"


    https://jp.example.com/hi/audio-video.m3u8


    #EXT-X-STREAM-INF:BANDWIDTH=1280000,CODECS="avc1.640028",PATHWAY-ID="JP"


    https://cn.example.com/low/audio-video.m3u8


    #EXT-X-STREAM-INF:BANDWIDTH=7680000,CODECS="avc1.640028",PATHWAY-ID="JP"


    https://jp.example.com/hi/audio-video.m3u8
    ϚελʔϓϨΠϦετهड़ྫ

    View full-size slide