Attaching and detaching observers - Storm iOS Library

Adding an observer consists in calling the function stormLibrary.addObserver(observer), where an observer is the class that implements the StormLibraryObserver protocol.

Attaching an observer

In the example below, we implemented the onVideoConnecting() and onVideoPlay() methods causing the console to display "connecting" message when Storm Library connects to the Storm server, and "play" when starting video playback.

class StormImpl : StormLibraryObserver{

    public var stormLibrary : StormLibrary

    init() {

        stormLibrary = StormLibrary()
        stormLibrary.addStormMediaItem(stormMediaItem: StormMediaItem(host: "", port: 443, isSSL: true, applicationName: "live", streamName: "test_hd", label: "720p", isSelected: true))


    func onVideoConnecting() {

    func onVideoPlay() {


A full list of events can be found in Library Events section and Video Events section.

Detaching an observer

In order to detach (remove) an event listener (observer) just use: