FOGMJPEGImageView is a UIImageView subclass dedicated to displaying a MJPEG from a remote feed.
A typical use case for FOGMJPEGImageView would be displaying a live webcam feed.
Copy the contents of the FOGMJPEGImageView directory into your project:
- FOGJPEGImageMarker.h
- FOGJPEGImageMarker.m
- FOGMJPEGDataReader.h
- FOGMJPEGDataReader.m
- FOGMJPEGImageView.h
- FOGMJPEGImageView.m
- FOGMJPEGImageViewDelegate.h
With an instantiated FOGMJPEGImageView simply call startWithURL:
passing the URL of the MJPEG feed you wish to display
FOGMJPEGImageView *mjpegImageView;
...
[mjpegImageView startWithURL:[NSURL URLWithString:@"http://192.168.0.1/mjpg/video.mjpg?camera=1"]];
You may halt the MJPEG feed by calling stop
.
[mjpegImageView stop];
If you want to get informed about certain event you can make your class conform to the FOGMJPEGImageViewDelegate
@interface MyClass () <FOGMJPEGImageViewDelegate>
Set your class as the delegate of the FOGMJPEGImageView
mjpegImageView.delegate = self;
And implement some or all of the given delegate methods from the protocol
- (void)FOGMJPEGImageViewDidReceiveImage:(FOGMJPEGImageView *)mjpegImageView
{
// Handle success.
}
- (void)FOGMJPEGImageView:(FOGMJPEGImageView *)mjpegImageView loadingImgaeDidFailWithError:(NSError *)error
{
// Handle error.
}
FOGMJPEGImageView is mainted by Richard C McGuire (@vf0g)
FOGMJPEGImageView is available under the MIT license. See the LICENSE file for more info.