0

How we cast local gallery video to GoogleCast SDK iOS?

let url = URL.init(string: "Local Gallery pickup URL file:///private/var/mobile/Containers/Data/PluginKitPlugin/CBC411B1-375B-44F1-8183-CD932E37F0F3/tmp/trim.922BBE6C-5C61-4613-B881-3FCF65079885.MOV")
guard let mediaURL = url else {
print("invalid mediaURL") return }
if let device = connectedDevice {
   castContext.discoveryManager.device(withUniqueID: device.uniqueID)
   castContext.sessionManager.startSession(with: device)
}
let metadata = GCKMediaMetadata()
metadata.setString("movieModel!.desc", forKey: kGCKMetadataKeyTitle)
metadata.setString("movieModel!.desc", forKey: kGCKMetadataKeySubtitle)
metadata.addImage(GCKImage(url: URL(string: "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/images/BigBuckBunny.jpg")!,width: 480,height: 360))
let mediaInfoBuilder = GCKMediaInformationBuilder.init(contentURL: mediaURL)
mediaInfoBuilder.streamType = GCKMediaStreamType.none;
mediaInfoBuilder.contentType = "video/mp4"
mediaInfoBuilder.metadata = metadata;
let mediaInformation = mediaInfoBuilder.build()
if let request = sessionManager.currentSession?.remoteMediaClient?.loadMedia(mediaInformation) {
request.delegate = self 
}
GCKCastContext.sharedInstance().presentDefaultExpandedMediaControls()

How we cast selected gallery video to GoogleCast Smart TV Device

3
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Commented May 1 at 22:34
  • Thank you for reply, Currently we are working on SmartTV Remote Control App, So we are connecting Android Smart TV with iOS and Control Buttons for left right top bottom or etc., Now we are working on Casting Video and Images from iOS to Smart TV, and we are using GoogleCastSDK but GoogleCastSDK play only server URL not gallery video, So we are searching on how to Cast ImagePicker Selected Video Cast to SmartTV using GoogleCast SDK or any SDK or Any Other code to Cast Videos. Commented May 2 at 4:25
  • We try with GoogleCast SDK but not finding proper solution, but we are now first select video from ImagePicker then upload to server then cast to SmartTV using GoogleCast but it's not proper solution, Let me know you have some solutions or SDK or anything to help us for iOS Swift Code. Thanks! Commented May 2 at 4:25

0