Slide 1

Slide 1 text

CarPlayͷରԠํ๏ͱ ೔ຊͰͷݱঢ় iOSDC Japan 2016 Yuji Hato

Slide 2

Slide 2 text

About me Yuji Hato CyberAgent, Inc. / AbemaTV, Inc. dekatotoro @dekatotoro Contributed service

Slide 3

Slide 3 text

What is CarPlay ରԠঢ়گ ରԠํ๏ UI ࣮૷ iOS10 ৽ػೳ ·ͱΊ

Slide 4

Slide 4 text

What is CarPlay • 2014೥3݄3೔ʹCarPlay͕ਖ਼ࣜൃද • iPhone୺຤ΛΧʔφϏ౳ͷंࡌػثʹ࿈ಈͤ͞Δ γεςϜ • MapsɺMusicɺPhoneɺMessagesɺPodcastsͳͲͷ iOSΞϓϦ΍SiriΛंࡌσΟεϓϨΠͰ௚઀ૢ࡞Ͱ͖Δ • αʔυύʔςΟͷAudioΞϓϦ΋ରԠՄೳ • ຊମΞϓϦͷҰ෦ͱͯ͠ಈ࡞͢Δ

Slide 5

Slide 5 text

IUUQXXXBQQMFDPNKQJPTDBSQMBZ

Slide 6

Slide 6 text

What is CarPlay ରԠঢ়گ ରԠํ๏ UI ࣮૷ iOS10 ৽ػೳ ·ͱΊ

Slide 7

Slide 7 text

ରԠ Device

Slide 8

Slide 8 text

ରԠ Device • iPhone5Ҏ্ • iPadɺiPodʹ͸ରԠ͍ͯ͠ͳ͍ IUUQXXXBQQMFDPNKQJPTDBSQMBZ

Slide 9

Slide 9 text

ରԠ iOS

Slide 10

Slide 10 text

ରԠ iOS • iOS7.1Ҏ্ • iOS8.4ɺiOS9.0ͰAPIʹগ͠มߋ͋Γ • iOS10ͰUIɺAPIʹมߋ͕ೖΔ

Slide 11

Slide 11 text

ରԠ ΞϓϦ

Slide 12

Slide 12 text

ରԠ ΞϓϦ • Tuneln Radio • MLB.com At Bat • NHK WORLD TV ? • Audible • VOX • Audio Books • Spotify • AWA ೔ຊ ւ֎ etc…

Slide 13

Slide 13 text

ରԠ φϏ

Slide 14

Slide 14 text

ରԠ φϏ ७ਖ਼φϏ ରԠφϏ ରԠंछ τϤλ εζΩ ଟػೳϝϞϦʔφϏήʔγϣϯ ΠάχεɺιϦΦɺεϖʔγΞɺϋεϥʔ ೔࢈ ϓϨϛΞϜφϏ બ୒φϏ࣍ୈ ϗϯμ ελϯμʔυφϏҎ্ બ୒φϏ࣍ୈɺ"DDPSEɺ-FHFOE౳͸º Ϛπμ ࡾඛ Ԥभ޲͚ύδΣϩɻ೔ຊ͸·ͩະରԠ εόϧ ࣍ظΠϯϓϨοα ϕϯπ " # $-" $-4 (-" (-&ɺࠓޙॱ࣍ #.8 "VEJ " 2ɻࠓޙॱ࣍ 78 $PNQPTJUJPONFEJB /FX1PMP 5JHVBOͳͲɻࠓޙॱ࣍ (. ೥Ҏ߱ൃചͷશϞσϧରԠ 'PSE ೥ൃചͷશϞσϧରԠ 7PMWP 9$4 7 αʔυύʔςΟ ରԠφϏ ύΠΦχΞ 41)%" ΞϧύΠϯ J-9 ೔ຊͰ͸ະൃച ϝʔΧʔϗʔϜϖʔδͳͲ͔Βͷಠࣗௐ΂ 2016/08/14ݱࡏ

Slide 15

Slide 15 text

What is CarPlay ରԠঢ়گ ରԠํ๏ UI ࣮૷ iOS10 ৽ػೳ ·ͱΊ

Slide 16

Slide 16 text

ରԠํ๏ 1. ։ൃ͍ͨ͠ࢫΛਃ੥͢Δ Լه͔Βࣗ෼ͷΞϓϦͰCarPlayʹରԠ͍ͨ͠ࢫΛਃ੥͢Δ https://developer.apple.com/contact/carplay/

Slide 17

Slide 17 text

ରԠํ๏ 2. Agreementͷૹ෇ 1ͷਃ੥͕OKͷ৔߹ɺAgreement͕ૹΒΕͯ͘ΔͷͰ಺༰Λ֬ೝ͠ ͯهೖɾॺ໊ͯ͠ฦૹ

Slide 18

Slide 18 text

ରԠํ๏ 3. TeamIDͷ֬ೝ Agreement͕໰୊ͳ͚Ε͹ɺTeamIDΛฉ͔ΕΔͷͰAppleʹ఻͑Δ ※͜ͷλΠϛϯάͰProgramingΨΠυ΋ૹΒΕ͖ͯ·͢

Slide 19

Slide 19 text

ରԠํ๏ 4. Provisioning Profileͷ࠶࡞੒ AppleʹΑΓCarPlay։ൃͷઃఆ͕༗ޮʹ͞ΕΔͱɺ Porvisioning Profile࡞੒࣌ʹCarPlayͷEntitlementsઃఆ͕ग़ͯ ͘ΔΑ͏ʹͳΓ·͢ɻ

Slide 20

Slide 20 text

ରԠํ๏ 5. Simulator CarPlay༻ͷSimulatorΛ࢖ͬͯ։ൃΛ͢Δ͜ͱ͕Ͱ͖·͢

Slide 21

Slide 21 text

What is CarPlay ରԠঢ়گ ରԠํ๏ UI ࣮૷ iOS10 ৽ػೳ ·ͱΊ

Slide 22

Slide 22 text

UI • Ϧετදࣔ • ֊૚ߏ଄ • ࠶ੜදࣔ • Τϥʔදࣔ

Slide 23

Slide 23 text

UI Ϧετදࣔ/֊૚ߏ଄ ୈ1֊૚ ୈ2֊૚ ୈ3֊૚

Slide 24

Slide 24 text

UI ࠶ੜදࣔ

Slide 25

Slide 25 text

UI Τϥʔදࣔ

Slide 26

Slide 26 text

What is CarPlay ରԠঢ়گ ରԠํ๏ UI ࣮૷ iOS10 ৽ػೳ ·ͱΊ

Slide 27

Slide 27 text

࣮૷ • MPPlayableContentManager • MPPlayableContentDataSource • MPPlayableContentDelegate Ϧετදࣔɾ֊૚ߏ଄

Slide 28

Slide 28 text

࣮૷ MPPlayableContentManager class CarPlayDemo: NSObject, MPPlayableContentDataSource, MPPlayableContentDelegate { static let shared = CarPlayDemo() func setup() { MPPlayableContentManager.sharedContentManager().delegate = self MPPlayableContentManager.sharedContentManager().dataSource = self } … } func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { … CarPlayDemo.shared.setup() … }

Slide 29

Slide 29 text

࣮૷ MPPlayableContentDataSource func numberOfChildItemsAtIndexPath(indexPath: NSIndexPath) -> Int { // indexPathʹԠͨ͡Ϧετͷ݅਺Λฦ͢ return 4 } func contentItemAtIndexPath(indexPath: NSIndexPath) -> MPContentItem? { // JOEFY1BUIʹԠͨ͡.1$POUFOU*UFNΛฦ͢ let contentItem = MPContentItem(identifier: "container1") contentItem.title = “container1" contentItem.artwork = CarPlayArtwork.Home.artwork contentItem.container = true contentItem.playable = false return contentItem }

Slide 30

Slide 30 text

࣮૷ MPPlayableContentDelegate func playableContentManager(contentManager: MPPlayableContentManager, initiatePlaybackOfContentItemAtIndexPath indexPath: NSIndexPath, completionHandler: (NSError?) -> Void) { // indexPathʹԠͨ͡ίϯςϯπΛ࠶ੜ … completionHandler(nil) }

Slide 31

Slide 31 text

࣮૷ ิ଍ NSIndexPath let indexPath = NSIndexPath(indexes: [1,4,3,2], length: 4) print(indexPath.length) // 4 print(indexPath.indexAtPosition(0)) // 1 print(indexPath.indexAtPosition(1)) // 4 print(indexPath.indexAtPosition(2)) // 3 print(indexPath.indexAtPosition(3)) // 2 // Get with pointer var indexesPtr = UnsafeMutablePointer.alloc(indexPath.length) indexPath.getIndexes(indexesPtr) let indexes = [Int](UnsafeBufferPointer(start: indexesPtr, count: indexPath.length)) indexes.forEach { value in print(value) // 1 4 3 2 }

Slide 32

Slide 32 text

࣮૷ • MPNowPlayingInfoCenter • MPRemoteCommandCenter ࠶ੜදࣔ/੍ޚ

Slide 33

Slide 33 text

࣮૷ MPNowPlayingInfoCenter var trackInfo: [String: AnyObject] = [:] trackInfo[MPMediaItemPropertyTitle] = "trackName" trackInfo[MPMediaItemPropertyArtist] = "artistName" trackInfo[MPMediaItemPropertyAlbumTitle] = "albumName" trackInfo[MPMediaItemPropertyPlaybackDuration] = 60 trackInfo[MPNowPlayingInfoPropertyElapsedPlaybackTime] = 10 trackInfo[MPNowPlayingInfoPropertyPlaybackRate] = isPlaying ? 1 : 0 trackInfo[MPMediaItemPropertyArtwork] = MPMediaItemArtwork(image: UIImage(asset: .ArtworkDemo)) MPNowPlayingInfoCenter.defaultCenter().nowPlayingInfo = trackInfo

Slide 34

Slide 34 text

࣮૷ MPRemoteCommandCenter let remoteCommandCenter = MPRemoteCommandCenter.sharedCommandCenter() remoteCommandCenter.nextTrackCommand.addTarget(self, action: #selector(RemoteCommand.next)) remoteCommandCenter.previousTrackCommand.addTarget(self, action: #selector(RemoteCommand.previous)) remoteCommandCenter.playCommand.addTarget(self, action: #selector(RemoteCommand.play)) remoteCommandCenter.pauseCommand.addTarget(self, action: #selector(RemoteCommand.pause)) remoteCommandCenter.togglePlayPauseCommand.addTarget(self, action: #selector(RemoteCommand.playOrPause)) …

Slide 35

Slide 35 text

࣮૷ Τϥʔදࣔ // MPPlayableContentDataSource func beginLoadingChildItemsAtIndexPath(indexPath: NSIndexPath, completionHandler: (NSError?) -> Void) { // Error completionHandler(CarPlayErrorType.NoData.error()) } // MPPlayableContentDelegate func playableContentManager(contentManager: MPPlayableContentManager, initiatePlaybackOfContentItemAtIndexPath indexPath: NSIndexPath, completionHandler: (NSError?) -> Void) { // Error completionHandler(CarPlayErrorType.PlaybackError.error()) }

Slide 36

Slide 36 text

࣮૷ • Ϧετͷੜ੒͸Ұ౓ʹ݅਺෼MPContentItem͕ੜ੒͞ΕΔ • MPContentItemͷidentifier͕ಉͩ͡ͱitem͕࠶ར༻͞ΕΔ • dataSourceɺdelegate͸ϝΠϯεϨουͰ͜ͳ͍ • iOS8.4͔Β͸MPPlayableContentManagerContext͕ར༻Ͱ͖Δ ஫ҙ఺

Slide 37

Slide 37 text

What is CarPlay ରԠঢ়گ ରԠํ๏ UI ࣮૷ iOS10 ৽ػೳ ·ͱΊ

Slide 38

Slide 38 text

iOS10 ৽ػೳ • λϒφϏήʔγϣϯͷαϙʔτ • γϟοϑϧͱϦϐʔτදࣔͳͲ • ࠶ੜதϝσΟΞͷϚʔΫදࣔ Audio apps • Siriαϙʔτ Automaker apps Messaging apps • Siriαϙʔτ

Slide 39

Slide 39 text

What is CarPlay ରԠঢ়گ ରԠํ๏ UI ࣮૷ iOS10 ৽ػೳ ·ͱΊ

Slide 40

Slide 40 text

·ͱΊ • UI͸γϯϓϧ • ։ൃίετ͸௿͍ • ೔ຊͰͷීٴ͸͜Ε͔Β φϏͷ෇ଳػೳͱͯ͠ͷCarPlay φϏͱͯ͠ͷCarPlay $BS1MBZͷφϏਫ਼౓վળػ ೳ֦ॆͱରԠΞϓϦͷ૿Ճ

Slide 41

Slide 41 text

Thank you ࢀߟࢿྉ http://www.apple.com/jp/ios/carplay/ https://developer.apple.com/carplay/ https://developer.apple.com/videos/play/wwdc2016/722/ https://developer.apple.com/videos/play/wwdc2016/723/ http://www.soumu.go.jp/johotsusintokei/whitepaper/ja/h26/html/nc141320.html http://news.mynavi.jp/articles/2016/01/17/carplay_androidauto_ces/