MjpegStream
@available(*, deprecated, message: "This does not work on Skyle 3")
public class MjpegStream : NSObject, URLSessionDelegate, URLSessionDataDelegate, ObservableObject
MjpegStream serves the video stream of Skyle.
-
Empty initilizer
Declaration
Swift
public override init()
-
Enum describing MjpegError
See moreDeclaration
Swift
internal enum MjpegStreamError : Error
-
The
image
property exposes aPublisher
which holds the current stream image. This is updated whenever a new image is available. -
The
cgimage
property exposes aPublisher
which holds the current stream image. This is updated whenever a new image is available.Declaration
Swift
@Published public var cgimage: CGImage? { get set }
-
The
state
property exposes aPublisher
which indicates the state of the stream of gaze data.Declaration
Swift
@Published private(set) public var state: States { get set }
-
This function is called when a retry occurs.
continue
needs to be called to actually continue with the retry. This is reset after each successful connection. Please set this before callingstart()
Declaration
Swift
public var doBeforeRetry: ((_ continue: @escaping () -> Void) -> Void)?
-
Starts a video stream by calling on the provided URL.
- url: A
URL
pointing to the streams origin. - retries: Maximum of retries.
Declaration
Swift
public func start(_ url: URL = URL(string: "http://skyle.local:8080/?action=stream")!)
- url: A
-
Stops the video stream and updating
state
.Declaration
Swift
public func stop()
-
Session Delegate implementation.
Declaration
Swift
public func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive response: URLResponse, completionHandler: @escaping (URLSession.ResponseDisposition) -> Void)
-
Session Delegate implementation.
Declaration
Swift
public func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data)
-
Session Delegate implementation.
Declaration
Swift
public func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?)
-
Session Delegate implementation.
Declaration
Swift
public func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask)
-
Session Delegate implementation.
Declaration
Swift
public func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?)