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

Synchronized iPhones, Again!

Tachibana Kaoru
September 21, 2020

Synchronized iPhones, Again!

Tachibana Kaoru

September 21, 2020
Tweet

More Decks by Tachibana Kaoru

Other Decks in Technology

Transcript

  1. 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) }
  2. 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) }
  3. Plan B : Core BT & Core BT Core Bluetooth

    Ͱෳ਺ηογϣϯΛߟ͑ͯΈ·͠ΐ͏
  4. Multipeer Connectivity Apple Engineer ʹΑΔͱɺݱࡏͰ͸΄ͱΜͲͷ୺຤Ͱ peer to peer WiFi Λ࢖͍ͬͯΔͦ͏ɻ

    1ηογϣϯ͋ͨΓͷ୺຤਺͸ެশ̓ʙ̔୆ ෳ਺ͷηογϣϯΛ࣋ͭ͜ͱ͕Ͱ͖Δɻ
  5. ΞυόλΠζ /// पғ΁Advertise͠·͢ɻ var advertiser: MCNearbyServiceAdvertiser? advertiser = MCNearbyServiceAdvertiser( ɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹpeer:

    myID, discoveryInfo: ["DeviceName":deviceName], serviceType: serviceID) advertiser?.delegate = self advertiser?.startAdvertisingPeer() BEWFSUJTJOH
  6. पғͷ୺຤ͷ୳ࡧ /// 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