我想知道是否有办法将视频从Raspberry Pi流式传输到原生iOS应用程序.
我不是在询问是否可以通过Web服务器进行流式处理,因为我已经知道如何做到这一点.但是,如果有一种方法可以从Web捕获流并将其显示在本机iOS应用程序中,而无需指向可以正常工作的Quicktime或Safari.例如.如果流正在192.168.0.1:8080上播放,则显示在我的iPhone应用程序中.
我目前正在使用带有Xcode 8.0(beta)和Swift 3的Raspberry Pi相机模块的Raspberry Pi 3 Model B.
提前谢谢了.
解决方法
我目前这样做:
import UIKit import AVKit import AVFoundation class ViewController: UIViewController,UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout { @IBOutlet weak var player_View: UIView! var playerControllerView: UIView! var player:AVPlayer?; let LOW_URL = URL(string:YOUR_STREAM_URL)! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view,typically from a nib. self.player = AVPlayer(url: LOW_URL) player?.currentItem!.add(videoOutput) let playerController = AVPlayerViewController() playerController.player = self.player self.playerControllerView = playerController.view; self.playerControllerView.layoutMargins.left = 0; self.playerControllerView.layoutMargins.top = 0; self.player_View.addSubview(self.playerControllerView) playerController.view.frame = self.player_View.bounds self.player?.play() }
player_View绑定到故事板中的UIView.