Latest 0.2.0
Homepage https://github.com/wrathchaos/MJPEGStreamLib
License MIT
Platforms ios 8.0
Authors


License


platform


Cocoapods


Downloads


Build


Issues


Swift 4.0Swift 3.0


Pod Version

Introduction

Simple and elegant MJPEG Stream library. It is based on UIImageView and customizeable for your design.
This is original a fork from MjpegStreamingKit

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • iOS 8.0+
  • XCode 8.1, 8.2, 8.3
  • XCode 9.0+
  • Swift 3.0, 3.1, 3.2
  • Swift 4.0+

Installation

MJPEGStreamLib is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "MJPEGStreamLib"

DO NOT FORGET TO ADD PERMISSION FOR EXTERNAL DATA NETWORK :

Usage

import MJPEGStreamLib

Once imported, you can open a connection to your WebSocket server.


class ViewController: UIViewController {
    @IBOutlet weak var imageView: UIImageView!
    @IBOutlet weak var loadingIndicator: UIActivityIndicatorView!

    var stream: MJPEGStreamLib!
    var url: URL?

    override func viewDidLoad() {
    super.viewDidLoad()

        // Set the ImageView to the stream object
        stream = MJPEGStreamLib(imageView: imageView)
        // Start Loading Indicator
        stream.didStartLoading = { [unowned self] in
        self.loadingIndicator.startAnimating()
    }
        // Stop Loading Indicator
        stream.didFinishLoading = { [unowned self] in
        self.loadingIndicator.stopAnimating()
    }

        // Your stream url should be here !
        let url = URL(string: "http://webcam.st-malo.com/axis-cgi/mjpg/video.cgi?")
        stream.contentURL = url
        stream.play() // Play the stream
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }

    // Make the Status Bar Light/Dark Content for this View
    override var preferredStatusBarStyle : UIStatusBarStyle {
        return UIStatusBarStyle.lightContent
        //return UIStatusBarStyle.default   // Make dark again
    }
}

Author

Kuray OGUN, [email protected]

License

MJPEGStreamLib is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "MJPEGStreamLib",
    "version": "0.2.0",
    "summary": "Simple MJPEG Stream Library for Swift",
    "description": "Simple and easy to use MJPEG Stream Library. It contains authentication if your stream url needs a username/password. It is based on UIImageView so it is all up to your custom design. Swift 4 and XCode 9.0+ Compatibility.",
    "homepage": "https://github.com/wrathchaos/MJPEGStreamLib",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "FreakyCoder": "[email protected]"
    },
    "source": {
        "git": "https://github.com/wrathchaos/MJPEGStreamLib.git",
        "tag": "0.2.0"
    },
    "social_media_url": "https://twitter.com/freakycodercom",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "MJPEGStreamLib/Classes/**/*",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This