I need to show video on smart tv from iphone programmatically

1.3k Views Asked by At

There is an application called Miracast This app is capable to mirror screen to Smart TV (I need specially Samsung TV) and play videos from gallery to the TV

I tried to search but couldn't find any resources online talking about this task

I am using Smart View SDK to connect to the TV, and I was able to show photos from Gallery on the TV

Here is the code to show photo on Samsung TV

 let appID: URL = URL(string: "http://prod-multiscreen-examples.s3-website-us-west-1.amazonaws.com/examples/photoshare/tv/")!
    let channelID: String = "com.samsung.multiscreen.photoshare"
    let msApplication = service.createApplication(appID as AnyObject, channelURI: channelID, args: nil)
    msApplication!.connectionTimeout = 5.0
    msApplication!.connect([:], completionHandler: { (client, error) in
        let data = self.compressImage(image: image)

        msApplication?.publish(event: "showPhoto", message: nil, data: data!, target: MessageTarget.Host.rawValue as AnyObject)
    })

If anyone has successfully worked on something similar or has any resources it will be appreciated

1

There are 1 best solutions below

1
On

Yes, yes yes. Its a very simply function call, just access the video file instead of the picture. So see https://developer.samsung.com/smarttv/design/smart-view-sdk.html#playback-sync the code is very, very simple to implement:

 let appID: URL = URL(string: "http://prod-multiscreen-examples.s3-website-us-west-1.amazonaws.com/examples/photoshare/tv/")!
    let channelID: String = "com.samsung.multiscreen.photoshare"
    let msApplication = service.createApplication(appID as AnyObject, channelURI: channelID, args: nil)
    msApplication!.connectionTimeout = 5.0
    msApplication!.connect([:], completionHandler: { (client, error) in
        let data = self.compressVideo(video: video) //this here is the key

        msApplication?.publish(event: "showPhoto", message: nil, data: data!, target: MessageTarget.Host.rawValue as AnyObject)
    })