Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/WrathChaos/MJPEGStreamLib
- Owner: WrathChaos
- License: mit
- Created: 2017-08-24T10:58:01.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-01-04T18:05:10.000Z (about 3 years ago)
- Last Synced: 2024-10-04T23:16:05.580Z (3 months ago)
- Language: Swift
- Homepage: http://www.freakycoder.com
- Size: 2.78 MB
- Stars: 35
- Watchers: 4
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-swift-lib-hunt - MJPEGStreamLib - Very simple and easy to use MJPEGStream Library (Network)
- awesome-swift-lib-hunt - MJPEGStreamLib - Very simple and easy to use MJPEGStream Library (Network)
README
# MJPEGStreamLib
## 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.