Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/WrathChaos/MJPEGStreamLib

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.
https://github.com/WrathChaos/MJPEGStreamLib

Last synced: 3 months ago
JSON representation

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.

Awesome Lists containing this project

README

        

# MJPEGStreamLib





License


platform


Cocoapods


Downloads



Build


Issues


Swift 5.0
Swift 4.2
Swift 4.0
Swift 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](https://github.com/freedom27/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+**
- Swift 4.2+
- **Swift 5.0+**

## Installation

MJPEGStreamLib is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod "MJPEGStreamLib"
```

DO NOT FORGET TO ADD PERMISSION FOR EXTERNAL DATA NETWORK :



## Usage
```ruby
import MJPEGStreamLib
```

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

```ruby

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.