Advanced Usage

Switch Stream URL

When Switching to a new stream URL, before passing new stream url(m3u8) to the player, pass that URL through SWCP2pEngine instance:

swift

let newParsedURL = SWCP2pEngine.sharedInstance().parse(streamURL: NEW_ORIGINAL_URL)

objective-c

NSURL *newParsedURL = [[SWCP2pEngine sharedInstance] parseStreamURL:NEW_ORIGINAL_URL];

Stop P2P

Stop p2p streaming of current source, but keep local proxy working:

swift

override func viewDidDisappear(_ animated: Bool) {
    SWCP2pEngine.sharedInstance().stopP2p()
}

objective-c

- (void)viewDidDisappear:(BOOL)animated {
    [SWCP2pEngine.sharedInstance stopP2p];
}

Stop P2P and Local Proxy

Stop p2p streaming of current source and local proxy:

swift

SWCP2pEngine.sharedInstance().shutdown()

objective-c

[SWCP2pEngine.sharedInstance shutdown];

Last updated

Was this helpful?