I want to cast device local photo to Chromecast but only loading screen is displayed on Chromecast and no photo is showed.
I successfully cast the video using this method .Please suggest me how can I show local photo to cromecast.
This is my code for cast photo to Chromecast
func sendPhotoFile() {
let port = String(HttpServerManager.shared.getServerURL())
let photoHttpUrl = port + "search.png"
let metadata = GCKMediaMetadata(metadataType: .photo)
metadata.setString("For Bigger Escape", forKey: kGCKMetadataKeyTitle)
metadata.addImage(GCKImage(url: URL(string: photoHttpUrl)!, width: kThumbnailWidth, height: kThumbnailHeight))
let mediaInfo: GCKMediaInformation = GCKMediaInformation(contentID: photoHttpUrl, streamType: .none, contentType: kTypePhoto, metadata: metadata, adBreaks: nil, adBreakClips: nil, streamDuration: 0, mediaTracks: nil, textTrackStyle: nil, customData: nil)
let session = GCKCastContext.sharedInstance().sessionManager.currentCastSession
if (session != nil) {
session?.remoteMediaClient?.loadMedia(mediaInfo)
}
}
I am looking for an example of casting an image to a chrome cast from a url. There doesn't seem to be an image cast example in the google cast sample repositories but i feel this must have been done before.
I have little experience with the chrome cast sdk developer console as well as the development of the apps themselves so any information would be greatly appreciated.