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

5分でSharePlay入門

tokorom
June 23, 2021

 5分でSharePlay入門

#potatotips #74 https://potatotips.connpass.com/event/214754/

- WWDC21
- iOS 15
- SharePlay
- Group Activities

tokorom

June 23, 2021
Tweet

More Decks by tokorom

Other Decks in Programming

Transcript

  1. ॴ༑ଠ:VUB5PLPSP J04UW04"QQ1SPHSBNNFS
    ෼Ͱ4IBSF1MBZೖ໳
    QPUBUPUJQT

    View full-size slide

  2. @tokorom tokorom
    Spinners Inc.
    ॴ ༑ଠ / Yuta Tokoro

    View full-size slide

  3. "HFOEB
    w 4IBSF1MBZͷ֓ཁ
    w ಈըͷ4IBSF1MBZΛ࣮૷

    View full-size slide

  4. 4IBSF1MBZͱ͸
    'BDF5JNF௨࿩தʹ཭Εͨ৔ॴͷ༑ୡͱΞϓϦͷίϯςϯπΛڞ༗

    View full-size slide

  5. 4IBSF1MBZͱ͸
    ར༻γʔϯ
    • Ұॹʹөը΍εϙʔπΛࢹௌ͢Δ
    • ήʔϜͷεʔύʔϓϨΠΛࣗຫ͢Δ
    • ཱྀߦͷͱ͖ͷࣸਅΛ༑ਓ΍Ո଒ͱҰॹʹݟΔ
    • άϧʔϓͰ͓ֆඳ͖͢Δ
    • Swift PlaygroundsͰҰॹʹSwiftΛֶͿ
    • ෆಈ࢈ΞϓϦͰ৽͍͠ՈͷީิΛ;ͨΓͰ୳͢
    • ࣮Ոͷ྆਌͕ΞϓϦͷ࢖͍ํ͕Θ͔Βͳ͍ͷΛαϙʔτ͢Δ

    View full-size slide

  6. छͷ4IBSF1MBZ
    ը໘ڞ༗ ಈըɾԻָͷڞࢹௌ ΧελϜ

    View full-size slide

  7. छͷ4IBSF1MBZ
    ը໘ڞ༗ ಈըɾԻָͷڞࢹௌ ΧελϜ

    View full-size slide

  8. छͷ4IBSF1MBZ
    ը໘ڞ༗ ಈըɾԻָͷڞࢹௌ ΧελϜ

    View full-size slide

  9. ը໘ڞ༗ʹରԠ͢Δͷʹඞཁͳίʔυ͸ʁ

    #ߦఔ౓
    $ߦఔ౓
    %ߦҎ্

    View full-size slide

  10. ը໘ڞ༗ʹରԠ͢Δͷʹඞཁͳίʔυ͸ʁ

    #ߦఔ౓
    $ߦఔ౓
    %ߦҎ্
    ͷ͸ͣʜJ04#FUBͰ͸࣮ಈΛ֬ೝͰ͖ͣະ֬ఆ

    View full-size slide

  11. ը໘ڞ༗͞Εͳ͍΋ͷ
    w ύεϫʔυͳͲηΩϡΞͳೖྗϑΟʔϧυ
    w ඞཁͳΒ֤ΞϓϦͰӅ͢΂͖ཁૉΛΧελϜՄೳ
    w %3.ʢ'BJS1MBZʣͰอޢ͞Εͨಈը

    View full-size slide

  12. छͷ4IBSF1MBZ
    ը໘ڞ༗ ಈըɾԻָͷڞࢹௌ ΧελϜ

    View full-size slide

  13. 57ΞϓϦͷྫ

    View full-size slide

  14. 57ΞϓϦͷྫ

    View full-size slide

  15. 57ΞϓϦͷྫ

    View full-size slide

  16. ಈըͷ4IBSF1MBZʹରԠ͢Δͱ
    w %3.Ͱอޢ͞Εͨίϯςϯπ΋4IBSF
    w ࠶ੜɾఀࢭɾγʔΫͳͲʹΑΔ࠶ੜҐஔͷಉظ

    View full-size slide

  17. ಈըͷ4IBSF1MBZʹඞཁͳίʔυ͸ʁ

    #ߦఔ౓
    $ߦఔ౓
    %ߦҎ্

    View full-size slide


  18. #ߦఔ౓
    $ߦఔ౓
    %ߦҎ্
    ಈըͷ4IBSF1MBZʹඞཁͳίʔυ͸ʁ

    View full-size slide

  19. ಈըͷ4IBSF1MBZͷ࣮૷αϯϓϧ
    https://github.com/tokorom/SharePlaySample

    View full-size slide

  20. ಈըͷ4IBSF1MBZͷ࣮૷αϯϓϧ
    struct SampleActivity: GroupActivity {


    static let movieURL: URL? = URL(string: "...")
    static let activityIdentifier = "..."




    var metadata: GroupActivityMetadata {


    var metadata = GroupActivityMetadata()
    metadata.fallbackURL = Self.movieURL
    metadata.title = "Sample"


    metadata.subtitle = "WWDC19 Session Video"
    return metadata


    }


    }


    (SPVQ"DUJWJUZΛ༻ҙ

    View full-size slide

  21. ಈըͷ4IBSF1MBZͷ࣮૷αϯϓϧ
    let activity = SampleActivity()


    async {


    switch await activity.prepareForActivation() {
    case .activationDisabled:


    break


    case .activationPreferred:


    activity.activate()


    case .cancelled:


    break


    default: ()


    }


    }


    (SPVQ"DUJWJUZΛΞΫςΟϕʔτ

    View full-size slide

  22. ಈըͷ4IBSF1MBZͷ࣮૷αϯϓϧ
    async {


    for await session in SampleActivity.sessions() {
    player.playbackCoordinator.coordinateWithSession(session)
    session.join()


    }


    }


    "71MBZFSͷಉظઃఆ

    View full-size slide

  23. ͦͷଞ
    w 1JDUVSFJO1JDUVSFͷαϙʔτ
    w 4IBSF1MBZதͷಈըΛςϨϏʹ"JS1MBZ
    w Ұ෦ͷϢʔβʔ͚ͩಈըΛר͖໭͢ʢҰ࣌తʹಉظ͠ͳ͍ʣͳͲͷΧελϜ
    w $.ͳͲ͕ڬ·ΕΔಈը΁ͷରॲ
    w "71MBZFSҎ֎ͷΧελϜಈըϓϨΠϠʔͷαϙʔτ
    w ࠶ੜಉظʹؔΘΒͳ͍ࣗ༝ͳΠϕϯτૹड৴
    w ΞϓϦΛΠϯετʔϧ͍ͯ͠ͳ͍ϢʔβʔΛ"QQ4UPSFʹ༠ಋ
    w αΠϯΞοϓ΍ߪೖ͕ඞཁͳ৔߹ͷରॲ
    w 8FCϖʔδʢNBD04ͷ4BGBSJʣͰͷϝσΟΞڞࢹௌͷαϙʔτʂ

    View full-size slide

  24. w .FFU(SPVQ"DUJWJUJFT
    w $PPSEJOBUFNFEJBFYQFSJFODFTXJUI(SPVQ"DUJWJUJFT
    w #VJMEDVTUPNFYQFSJFODFTXJUI(SPVQ"DUJWJUJFT
    .PSF*OGPSNBUJPO
    w %FTJHOGPS(SPVQ"DUJWJUJFT
    IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZXXED
    IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZXXED
    IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZXXED
    IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZXXED
    w $PPSEJOBUFNFEJBQMBZCBDLJO4BGBSJXJUI(SPVQ"DUJWJUJFT
    IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZXXED
    ˞ຊࢿྉʹܝࡌ͍ͯ͠ΔεΫϦʔϯγϣοτ͸্ه88%$ηογϣϯϏσΦΑΓൈਮͨ͠΋ͷͰ͢

    View full-size slide