RVS_MediaServer_HTTPServerManager
class RVS_MediaServer_HTTPServerManager
This is a model for the HTTP server instance.
-
The size of time slices in the HLS output. ffmpeg defaults to 2. Apple recommends 6.
Declaration
Swift
private static let _hlsTimeSliceInSeconds: Int -
The number of seconds to wait between page refreshes, while waiting to load.
Declaration
Swift
private static let _pageReloadDelayInSeconds: Float -
The number of seconds to wait as a timeout, when starting the server.
Declaration
Swift
private static let _serverStartTimeoutThresholdInSeconds: TimeInterval
-
This is a timer that we use to trap too long a wait.
Declaration
Swift
private var _timeoutTimer: Timer! -
This will hold the url of our output streaming file.
Declaration
Swift
private var _outputTmpFile: TemporaryFile! -
Declaration
Swift
private let _port: Int -
Declaration
Swift
private let _streamName: String
-
This is a Web Server instance that is associated with this stream. Its lifetime is the lifetime of the object (not persistent).
Declaration
Swift
var webServer: GCDWebServer? -
A delegate object for handling the operation of the manager. This is a weak class reference.
Declaration
Swift
weak var delegate: RVS_MediaServer_HTTPServerManagerDelegate!
-
Accessor for the temporary HTTP server file.
Declaration
Swift
var tempOutputFileURL: URL! { get } -
Accessor for the temporary HTTP server directory.
Declaration
Swift
var tempOutputDirURL: URL! { get }
-
Declaration
Swift
init(outputTmpFile inOutputTmpFile: TemporaryFile, port inPort: Int, streamName inStreamName: String, delegate inDelegate: RVS_MediaServer_HTTPServerManagerDelegate! = nil)Parameters
outputTmpFileThe temporary file object that describes the temporary directory, where we fetch our data.
portA TCP Port for the server to use.
streamnameA name to use for the stream.
delegateThe delegate for the object. This is optional.
-
This simply starts the Web server.
Declaration
Swift
func startHTTPServer()Parameters
webServerHandlerThis is an optional handling closure for Web Server calls. If not provided (or set to nil), then whatever we already have is used. This will replace any existing handler.
-
This simply stops the Web server.
Declaration
Swift
func stopHTTPServer()
-
This is the HTTP server callback. It is called with HTTP requests from the server, and we handle it all here.
Declaration
Swift
func webServerHandler(_ inRequestObject: GCDWebServerRequest) -> GCDWebServerDataResponse!Parameters
inRequestObjectThe request from the server.
Return Value
A data response; usually some form of HTML or stream data.
-
This will catch a timeout, stop the server, and throw up an error alert.
Declaration
Swift
@objc func timerDone(_ inTimer: Timer) -
This will throw up an error alert, if we encounter an error.
Declaration
Swift
func handleError(message inMessage: String = "")Parameters
messageA string, with the error message to be displayed, in un-localized form.
View on GitHub
RVS_MediaServer_HTTPServerManager Class Reference