2

有一个名为Miracast的应用程序此应用程序能够将屏幕镜像到智能电视(我特别需要三星电视)并将视频从画廊播放到电视

我试图搜索但在网上找不到任何关于此任务的资源

我正在使用Smart View SDK连接到电视,并且能够在电视上显示图库中的照片

这是在三星电视上显示照片的代码

 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)
    })

如果有人成功地从事过类似的工作或有任何资源,将不胜感激

4

1 回答 1

0

对对对。它是一个非常简单的函数调用,只需访问视频文件而不是图片。所以见https://developer.samsung.com/smarttv/design/smart-view-sdk.html#playback-sync代码实现起来非常非常简单:

 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)
    })
于 2020-04-13T01:02:52.093 回答