Since iOS SDK build 2.6.48 it is possible to check if a stream with a given name is available on a server for playback, like WebSDK function Stream.available().
To do this:
1. Create a separate Stream object with the stream name to check availability
Objective C code
FPWCSApi2Session *session = [FPWCSApi2 getSessions][0];
FPWCSApi2StreamOptions *options = [[FPWCSApi2StreamOptions alloc] init];
options.name = _remoteStreamName.text;
options.display = _remoteDisplay;
FPWCSApi2Stream *stream = [session createStream:options error:nil];
Swift code
let options = FPWCSApi2StreamOptions()
options.name = playName.text;
options.display = remoteDisplay.videoView;
do {
playStream = try session!.createStream(options)
...
} catch {
print(error)
}
2. Call available() method with callback function to get availability status and reason if stream is not available
Objective C code
[stream available:^(BOOL available, NSString *info) {
[self changeViewState:button enabled:YES];
if (available) {
_remoteStreamStatus.text = @"AVAILABLE";
_remoteStreamStatus.textColor = [UIColor greenColor];
} else {
_remoteStreamStatus.text = info;
_remoteStreamStatus.textColor = [UIColor redColor];
}
}];
Swift code
...
do {
playStream = try session!.createStream(options)
playStream?.available({ (available, info) in
self.changeViewState(self.availableButton, true)
if (available) {
self.playStatus.text = "AVAILABLE"
self.playStatus.textColor = .green
} else {
self.playStatus.text = info
self.playStatus.textColor = .red
}
})
} catch {
print(error)
}