有一个名为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)
})
如果有人成功从事类似工作或拥有任何资源,将不胜感激
最佳答案
对对对。它是一个非常简单的函数调用,只需访问视频文件而不是图片即可。因此,请参见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)
})
关于ios - 我需要以编程方式通过iPhone在智能电视上播放视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60930044/