Streaming video from Raspberry PI to native iOS app?

I am wondering if there is a way to transfer video from the Raspberry Pi to a native iOS app.

I do not ask if it is possible to transfer through a web server, since I already know how to do it. However, if there is a way to capture a stream from the Internet and display it in an iOS app without being directed to Quicktime or Safari, this will work fine. For instance. if the stream is playing on 192.168.0.1:8080 to display this in my application for iPhone.

I am currently working on a Raspberry Pi 3 Model B + with a Raspberry Pi camera module with Xcode 8.0 (beta) and Swift 3.

Thank you very much in advance.

+4
source share
1 answer

I have currently done this with this:

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 tied to a UIView in a storyboard.

0
source

All Articles