Slide 1

Slide 1 text

Synchronized iPhones, Again! iOSDC 2020 @TachibanaKaoru

Slide 2

Slide 2 text

Aboud Me @TachibanaKaoru ϑϦʔϥϯε iOS ΤϯδχΞ ຊ೔͸ϦΞϧΞόλʔͰొஃ͠·͢ɻ

Slide 3

Slide 3 text

ࠓ೔ͷ͓୊ ͨ͘͞ΜͷiPhone Λಉظ͢Δɻ

Slide 4

Slide 4 text

iPhoneͷಉظ ಉظͱ͸ ͳΜΒ͔ͷωοτϫʔΫΛհͨ͠ঢ়ଶͰɺෳ਺ͷ୺຤͕ಉ͡ಈ͖Λ͢ Δ͜ͱɻ

Slide 5

Slide 5 text

DEMO

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

લఏ৚݅ ʢ̍ʣ୺຤୆਺͕20~30୆ ʢ̎ʣωοτϫʔΫʹґଘ͠ͳ͍ ʢ̏ʣࣗಈతͳάϧʔϐϯά ʢ̐ʣ༗ػతͳάϧʔϐϯά

Slide 8

Slide 8 text

લఏ৚݅ ʢ̍ʣ୺຤୆਺͕20~30୆ ٕज़త೉қ౓Λߟྀ ౰વ iPhone ΍ iPadʹݶΓ·͢ɻ

Slide 9

Slide 9 text

લఏ৚݅ ʢ̎ʣωοτϫʔΫʹґଘ͠ͳ͍ ܞଳճઢ΍WiFi͕ͳͯ͘΋ಈ࡞͢Δɻ ͦͷ͋ͨΓͷެԂͰ΋Ωϟϯϓ৔Ͱ΋ࢁͷ্Ͱ΋େৎ෉ɻ αʔόʔϨεͰಈ࡞

Slide 10

Slide 10 text

લఏ৚݅ ʢ̏ʣࣗಈతͳάϧʔϐϯά ΞϓϦΛىಈ͢ΔͱࣗಈతʹάϧʔϓΛܗ੒͢Δɻ ʮˎˎͷάϧʔϓʹࢀՃ͠·͔͢ʁʯͱ͔ฉ͔ͳ͍ɻ Ϣʔβʔ͕खಈͰొ࿥͢Δ͜ͱ͸ͳ͘ɺࣗಈͰ઀ଓ͢Δɻ

Slide 11

Slide 11 text

લఏ৚݅ ʢ̐ʣ༗ػతͳάϧʔϐϯά άϧʔϓʹ్த͔ΒͰ΋ࢀՃͰ͖Δ Ͳͷϝϯόʔ͕཭୤ͯ͠΋ɺάϧʔϓ͕γʔϜϨεʹܧଓ͢Δɻ

Slide 12

Slide 12 text

Demo Movie ߹ܭ35୆ͷiPhoneͷө૾͕ಉ ظ͢ΔσϞө૾Ͱ͕͢……

Slide 13

Slide 13 text

Demo Movie ͝ΊΜͳ͍͞ɻ ͜Ε͸ARͰ͢ɻ

Slide 14

Slide 14 text

Demo Movie Reality Composer File + Xcode Ͱߏ੒ͨ͠AR ΞϓϦ Ͱ͢ɻ

Slide 15

Slide 15 text

RealityComposer Apple੡ͷ3Dฤूπʔϧ 3DΦϒδΣΫτͷ഑ஔ΍Ξχϝʔγϣϯ ͷઃఆͳͲ͕ՄೳͰ͢ɻ ෳࡶͳϞσϦϯά͸Ͱ͖·ͤΜ͕ɺ͙͢࢖ ͑Δ਺ेछྨͷϞσϧؚ͕·Ε͍ͯ·͢ɻ ؆୯ͳARɾ3DΞϓϦΛͭ͘Δͷʹదͯ͠ ͍·͢ɻ

Slide 16

Slide 16 text

RealityComposerͱXcodeͷ࿈ܞ RealityComposerଆ͔ΒXcodeͷΞΫγϣϯΛىಈɻ Xcode͔ΒRealityComposerଆ΁NotificationΛૹ৴ɻ ʢInterfaceBuilderͰIBActionΛఆٛ͠ɺͦͷActionத਎Λ࣮૷͢Δͷͱࣅ ͍ͯ·͢ɻʣ Notification Action

Slide 17

Slide 17 text

VideoMaterial iOS14.0Ҏ߱Ͱ͸ɺRealityComposerͰɺಈըΛ࠶ੜ͢ΔVideoMaterial Λ ࢖͏͜ͱ͕Ͱ͖·͢ɻ ෺ମͷද໘Ͱ޷͖ͳө૾Λ࠶ੜ͢Δ͜ͱ͕Ͱ͖·͢ɻ

Slide 18

Slide 18 text

Demo Movie App RealityComposer Ͱɺ35ݸͷࠇ͍ϓ ϨʔτͷΦϒδΣΫτΛ࡞੒ɻ RealityCopomserଆͰɺBehaviorΛઃఆ ͠ɺͲΕ͔ΛClickͨ͠ΒXcodeଆͷ Action͕ىಈ͢ΔΑ͏ʹ͍ͯ͠·͢ɻ

Slide 19

Slide 19 text

Demo Movie App XcodeଆͷActionͰɺ͋Β͔͡ ΊࡱӨͯ͋ͬͨ͠ಈըΛηο τͨ͠VideoMaterialΛࠇ͍ϓ ϨʔτΦϒδΣΫτʹͷͤͯ ͍·͢ɻ

Slide 20

Slide 20 text

VideoMaterial ͷੜ੒ var videoMaterial: VideoMaterial? if let url = Bundle.main.url(forResource: "movie", withExtension: "mp4"){ let item = AVPlayerItem(asset: AVAsset(url: url)) let player = AVPlayer(playerItem: item) videoMaterial = VideoMaterial(avPlayer: player) }

Slide 21

Slide 21 text

VideoMaterialͷEntityͷ௥Ճ boxAnchor.actions.addMovieToiPhone.onAction = { entity in self.videoMaterial?.avPlayer?.play() let thinBox = MeshResource.generateBox( width: 0.125, height: 0.01, depth: 0.065) let screenEntity = ModelEntity( mesh: thinBox, materials: [self.videoMaterial!]) entity?.addChild(screenEntity) }

Slide 22

Slide 22 text

Demo Movie App ӈͷө૾Ͱ͸ARΞϓϦͰ࣮ݱ ͠·͕ͨ͠ɺ͜Εͱಉ͜͡ͱ Λ࣮ࡍͷ୺຤ͱ࣮ࡍͷΞϓϦ Ͱ΍ͬͯΈΑ͏ɺͱ͍͏ͷ͕ ࠓ೔ͷ͓୊Ͱ͢ɻ ͜ͷϓϨθϯͷऴΘΓʹ͸ɺ ຊ෺ͷΞϓϦΛಈ࡞ͤͨ͞σ ϞΛ͓ݟͤ͠·͢ɻ

Slide 23

Slide 23 text

લఏ৚݅ ʢ̍ʣ୺຤୆਺͕20~30୆ ʢ̎ʣωοτϫʔΫʹґଘ͠ͳ͍ ʢ̏ʣࣗಈతͳάϧʔϐϯά ʢ̐ʣ༗ػతͳάϧʔϐϯά

Slide 24

Slide 24 text

લఏ৚݅ ʢ̍ʣ୺຤୆਺͕20~30୆ ʢ̎ʣωοτϫʔΫʹґଘ͠ͳ͍ ʢ̏ʣࣗಈతͳάϧʔϐϯά ʢ̐ʣ༗ػతͳάϧʔϐϯά

Slide 25

Slide 25 text

Plan A : Core Bluetooth ۙڑ཭ແઢͱ͍͑͹Bluetooth पғͷແઢঢ়گʹґଘͤͣʹɺ୺຤ؒͰ௨৴Λ͢Δ͜ͱ͕Ͱ͖·͢ ͜ΕͰάϧʔϐϯάΛߦͬͯΈ·͢ɻ

Slide 26

Slide 26 text

Grouping with CoreBT CBCentral CBPeripheral CBCentral CBCentral CBCentral

Slide 27

Slide 27 text

Grouping with CoreBT Core BluetoothͰ͸̍ηογϣϯͷ୺຤ͷ্ݶ਺͕͋Γ·͢ɻ ؀ڥ΍σόΠεʹ΋ΑΔ͕ɺ͍͍ͩͨ̐ʙ̑୆͘Β͍ɻ ʢલఏ৚݅̍ΛΫϦΞͰ͖·ͤΜʣ

Slide 28

Slide 28 text

Plan B : Core BT & Core BT Core Bluetooth Ͱෳ਺ηογϣϯΛߟ͑ͯΈ·͠ΐ͏

Slide 29

Slide 29 text

Double Session ?

Slide 30

Slide 30 text

Double Session ?

Slide 31

Slide 31 text

Sessions in Core Bluetooth Core Bluetooth Ͱ͸ɺ1ϓϩηε͋ͨΓԼهͷηογϣϯ͔࣋ͯ͠ͳ͍ Peripheralͱͯ͠ͷηογϣϯ : 1 Centralͱͯ͠ͷηογϣϯ : 1

Slide 32

Slide 32 text

Double Session

Slide 33

Slide 33 text

Double Session ͜ͷ୺຤͸ Peripheralͱ CentralΛ͔ͶΔɻ

Slide 34

Slide 34 text

Double Session ͜ͷߏ੒͕ಈ͚͹ 20୆ఔ౓ͷάϧʔ ϓ͕࡞੒Ͱ͖Δ͸ ͣ……ɻ

Slide 35

Slide 35 text

࣮૷ͯ͠Έ·ͨ͠ɻ

Slide 36

Slide 36 text

Double Session πϦʔߏ଄ͷά ϧʔϓ͸ܗ੒Ͱ͖ ͨ΋ͷͷɺඇৗʹ ෆ҆ఆ

Slide 37

Slide 37 text

Ͳ͏͠Α͏……ɻ

Slide 38

Slide 38 text

ͦͷλΠϛϯάͰ88%$

Slide 39

Slide 39 text

ωοτϫʔΫϥϘͰ૬ஊͯ͠Έ·ͨ͠

Slide 40

Slide 40 text

Plan C : Multipeer Connectivity ʮ ……ͬͯײ͡ͰωοτϫʔΫΛ࡞Γ͍ͨΜ͚ͩͲ͍͍Ҋ͋Δʁʯ : ͦΕͳΒ Multiplier Connectivity͕͍͍Αʂ

Slide 41

Slide 41 text

Plan C : Multipeer Connectivity Multipeer Connectivity͸ɺωοτϫʔΫϨΠϠʔͱͯ͠Bluetooth·ͨ͸ peer to peer WiFiΛ࢖͍ͬͯ·͢ɻ

Slide 42

Slide 42 text

Multipeer Connectivity Apple Engineer ʹΑΔͱɺݱࡏͰ͸΄ͱΜͲͷ୺຤Ͱ peer to peer WiFi Λ࢖͍ͬͯΔͦ͏ɻ 1ηογϣϯ͋ͨΓͷ୺຤਺͸ެশ̓ʙ̔୆ ෳ਺ͷηογϣϯΛ࣋ͭ͜ͱ͕Ͱ͖Δɻ

Slide 43

Slide 43 text

Single session network

Slide 44

Slide 44 text

Double session network

Slide 45

Slide 45 text

Double Session with MC ࣮૷ͯ͠Έͨͱ͜Ζɺ̎ͭͷηογϣϯͰ҆ఆͨ͠௨৴Λߦ͏͜ͱ͕Ͱ ͖·ͨ͠ɻ

Slide 46

Slide 46 text

લఏ৚݅ ʢ̍ʣ୺຤୆਺͕20~30୆ ʢ̎ʣωοτϫʔΫʹґଘ͠ͳ͍ ʢ̏ʣࣗಈతͳάϧʔϐϯά ʢ̐ʣ༗ػతͳάϧʔϐϯά

Slide 47

Slide 47 text

લఏ৚݅ ʢ̍ʣ୺຤୆਺͕20~30୆ ʢ̎ʣωοτϫʔΫʹґଘ͠ͳ͍ ʢ̏ʣࣗಈతͳάϧʔϐϯά ʢ̐ʣ༗ػతͳάϧʔϐϯά

Slide 48

Slide 48 text

MultipeerConnectivity Network ֤୺຤͸ɺ઀ଓ༻ͷ unique ͳ Peer IDΛੜ੒͠·͢ɻ(MCPeerID) ֤୺຤͸ɺMCNearbyServiceAdvertiserͰɺपғʹΞυόλΠζΛ͠·͢ɻ MCNearbyServiceBrowserΛ࢖͏ͱɺपғͷΞυόλΠζΛ͍ͯ͠Δ୺຤ Λൃݟ͢Δ͜ͱ͕Ͱ͖·͢ɻ ୺຤A͔Βɺ୺຤B΁઀ଓ͢Δ৔߹ʹ͸ɺηογϣϯΛ࡞੒͠ɺInvitation ΛA͔ΒB΁ૹ৴͢ΔɻB͕InvitationΛड୚͢Δͱηογϣϯ͕੒ཱ͢Δɻ

Slide 49

Slide 49 text

ΞυόλΠζ /// पғ΁Advertise͠·͢ɻ var advertiser: MCNearbyServiceAdvertiser? advertiser = MCNearbyServiceAdvertiser( ɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹpeer: myID, discoveryInfo: ["DeviceName":deviceName], serviceType: serviceID) advertiser?.delegate = self advertiser?.startAdvertisingPeer() BEWFSUJTJOH

Slide 50

Slide 50 text

पғͷ୺຤ͷ୳ࡧ /// BrowserΛ࡞੒͠ɺपғͷ୺຤Λ୳ࡧ͠·͢ɻ var serviceBrowser: MCNearbyServiceBrowser? serviceBrowser = MCNearbyServiceBrowser(peer: myPeer, serviceType: serviceID) serviceBrowser?.delegate = self serviceBrowser?.startBrowsingForPeers() /// delegateͰݟ͚ͭͨ୺຤Λ֬ೝ͢Δ͜ͱ͕Ͱ͖·͢ɻ func browser(_ browser: MCNearbyServiceBrowser, foundPeer peerID: MCPeerID, withDiscoveryInfo info: [String : String]?) { } BEWFSUJTJOH CSPXTJOH

Slide 51

Slide 51 text

ଞͷ୺຤΁ͷ઀ଓ serviceBrowser?.invitePeer(peer, to: session, withContext: nil, timeout: 10.0) BEWFSUJTJOH CSPXTJOH TFOE JOWJUBUJPO

Slide 52

Slide 52 text

Ϧʔμʔ୺຤͔ΒInvitationΛૹΔ

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

Ͳͷ୺຤͕Ϧʔμʔʁ

Slide 55

Slide 55 text

Ϧʔμʔͷܾఆ PeerID Λ Random ͳ Int PeerID ͷେখͰϦʔμʔΛܾఆ

Slide 56

Slide 56 text

ىಈʜʜ

Slide 57

Slide 57 text

֤ࣗ*%ΛऔಘɺΞυόλΠζ

Slide 58

Slide 58 text

पғͷ୺຤ͷ*%Λ୳ࡧ͠ɺʮʯ ͕ϦʔμʔͰ͋ΔͱΘ͔Δ पғͷ୺຤ͷ*%Λ୳ࡧ͠ɺࣗ෼͕ ϦʔμʔͰ͋ΔͱΘ͔Δɻ

Slide 59

Slide 59 text

ͭͷηογϣϯΛ࡞Γɺͦ ΕͧΕ*OWJUBUJPOΛૹ৴

Slide 60

Slide 60 text

session A session B

Slide 61

Slide 61 text

લఏ৚݅ ʢ̍ʣ୺຤୆਺͕20~30୆ ʢ̎ʣωοτϫʔΫʹґଘ͠ͳ͍ ʢ̏ʣࣗಈతͳάϧʔϐϯά ʢ̐ʣ༗ػతͳάϧʔϐϯά

Slide 62

Slide 62 text

લఏ৚݅ ʢ̍ʣ୺຤୆਺͕20~30୆ ʢ̎ʣωοτϫʔΫʹґଘ͠ͳ͍ ʢ̏ʣࣗಈతͳάϧʔϐϯά ʢ̐ʣ༗ػతͳάϧʔϐϯά

Slide 63

Slide 63 text

άϧʔϓܗ੒ޙͷΠϕϯτ ৽ͨͳ୺຤ͷࢀՃ άϧʔϓ͔Βͷ୺຤ͷ཭୤

Slide 64

Slide 64 text

৽ͨͳ୺຤ͷࢀՃ ϦʔμʔΑΓऑ͍୺຤ ϦʔμʔΑΓڧ͍୺຤

Slide 65

Slide 65 text

Ϧʔμʔ୺຤ΑΓऑ͍୺຤ͷࢀՃ session A session B

Slide 66

Slide 66 text

Ϧʔμʔ୺຤ΑΓڧ͍୺຤ͷࢀՃ session A session B

Slide 67

Slide 67 text

Ϧʔμʔ୺຤ΑΓڧ͍୺຤ͷࢀՃ طଘͷηογϣϯΛ ͍ͬͨΜऴྃ

Slide 68

Slide 68 text

Ϧʔμʔ୺຤ΑΓڧ͍୺຤ͷࢀՃ ࠶౓ɺपғͷ୺຤ͷ ୳ࡧΛߦ͏ɻ

Slide 69

Slide 69 text

Ϧʔμʔ୺຤ΑΓڧ͍୺຤ͷࢀՃ

Slide 70

Slide 70 text

Ϧʔμʔ୺຤ΑΓڧ͍୺຤ͷࢀՃ ৽ͨͳηογϣϯͷ࡞੒

Slide 71

Slide 71 text

άϧʔϓ͔Βͷ୺຤ͷ཭୤ ϦʔμʔҎ֎͕཭୤ Ϧʔμʔ͕཭୤

Slide 72

Slide 72 text

ϦʔμʔҎ֎ͷ୺຤ͷ཭୤ ϦʔμʔҎ֎͕཭୤

Slide 73

Slide 73 text

ϦʔμʔҎ֎ͷ୺຤ͷ཭୤ ϦʔμʔҎ֎͕཭୤ͯ͠΋ ηογϣϯ͸ܧଓ͢Δ

Slide 74

Slide 74 text

Ϧʔμʔͷ཭୤ Ϧʔμʔ͕཭୤

Slide 75

Slide 75 text

Ϧʔμʔͷ཭୤ Ϧʔμʔ͕཭୤͢Δͱ ೋͭͷηογϣϯʹଐ͢Δ୺຤͕ͳ͘ͳͬͯ͠·͏ ͨΊɺωοτϫʔΫ͕ܧଓͰ͖ͳ͍

Slide 76

Slide 76 text

session A session B

Slide 77

Slide 77 text

session A session B

Slide 78

Slide 78 text

Slide 79

Slide 79 text

Slide 80

Slide 80 text

Slide 81

Slide 81 text

༗ػతͳάϧʔϐϯά ͜ΕͰԼهͷΠϕϯτͷ͢΂ͯʹରԠ͠ɺࣗݾ૊৫Խ͢Δάϧʔϐϯάͱ ͳΓ·ͨ͠ɻ ϦʔμʔΑΓऑ͍୺຤ͷࢀՃ ϦʔμʔΑΓڧ͍୺຤ͷࢀՃ Ϧʔμʔͷ཭୤ ϦʔμʔҎ֎ͷ୺຤ͷ཭୤

Slide 82

Slide 82 text

άϧʔϐϯάͷલఏ৚݅ ʢ̍ʣ୺຤୆਺͕20~30୆ ʢ̎ʣωοτϫʔΫʹґଘ͠ͳ͍ ʢ̏ʣࣗಈతͳάϧʔϐϯά ʢ̐ʣ༗ػతͳάϧʔϐϯά

Slide 83

Slide 83 text

ʢຊ෺ͷʣDEMO

Slide 84

Slide 84 text

No content

Slide 85

Slide 85 text

άϧʔϐϯάશମͷΠϕϯτઃܭ ࣮ࡍͷάϧʔϐϯάॲཧʹ͸ɺ៛ີͳάϧʔϓશମઃܭ͕ඞཁ MultipeerConnectivityͷෳ਺ηογϣϯͷΠϕϯτͷϋϯυϦϯά ͢΂ͯͷ୺຤ͷϢʔβʔೖྗͷϋϯυϦϯά ͦͷଞγεςϜΠϕϯτ

Slide 86

Slide 86 text

άϧʔϐϯάશମͷΠϕϯτઃܭ άϧʔϓશମͷΠϕϯτϧʔϓΛϦʔμʔ୺຤Ͱઃܭ͠ɺ௨ৗͷΠϕϯτ ϧʔϓͱ͸ผʹ؅ཧ͢Δ͜ͱ͕๬·͍͠ɻ

Slide 87

Slide 87 text

Ԡ༻

Slide 88

Slide 88 text

MCͷ double session Ͱ Eternal Network

Slide 89

Slide 89 text

MCͷ double session Ͱ Tree Network 73 iPhones!

Slide 90

Slide 90 text

iPhone 73୆ iPhone 11 ͷ࠷҆Ϟσϧ 74,800ԁʢ੫ผʣ 73୆ͩͱɺ੫ࠐΈͰ̒̌̌ສ̒̐̐̌ԁ ࢿ͕ۚू·ͬͨΒݺΜͰ͍ͩ͘͞ɻ

Slide 91

Slide 91 text

·ͱΊ MultiPeer Connectivityͷෳ਺ηογϣϯΛ׆༻͢Δ͜ͱʹΑΓɺଟ਺ͷ୺຤Λ ಉظ͢Δ͜ͱ͕Ͱ͖·͢ɻ ࣗݾ૊৫Խ͢ΔάϧʔϐϯάઃܭΛߦ͏৔߹ʹ͸ηογϣϯͷ୺຤ͷࢀՃɾ཭ ୤ॲཧʹ஫ҙ͢Δඞཁ͕͋Γ·͢ɻ ARΛ࢖͏ͱ೔ৗੜ׆ͷதͰͷΞϓϦར༻ DEMO Λ؆୯ʹ࡞Ε·͢ɻ ϦΞϧΞόλʔͰͷొஃ͸ݟͨ໨ΑΓͣͬͱϋʔυͰ͢ɻࢎܽʹͳΓͦ͏Ͱ ͢ɻ͓͢͢Ί͠·ͤΜɻ