When stream status 'kFPWCSStreamStatusFailed' is received, stream getStatusInfo method returns the code of error occurred, that can be converted to the description string with streamStatusToString method. Errors occurred during SIP call are handled the same way.
Errors list
Error | Description string |
---|---|
kFPWCSStreamStatusInfo | |
kFPWCSStreamStatusInfoFailedByIceError | Failed by ICE error |
kFPWCSStreamStatusInfoFailedByIceTimeout | Failed by ICE timeout |
kFPWCSStreamStatusInfoFailedByKeepAlive | Failed by ICE keep alive |
kFPWCSStreamStatusInfoFailedByDtlsFingerprintError | Failed by DTLS fingerprint error |
kFPWCSStreamStatusInfoFailedByDtlsError | Failed by DTLS error |
kFPWCSStreamStatusInfoFailedByHlsWriterError | Failed by HLS writer error |
FPWCSStreamStatusInfoFailedByRtmpWriterError | Failed by RTMP writer error |
kFPWCSStreamStatusInfoFailedByRtpActivity | Failed by RTP activity |
kFPWCSStreamStatusInfoStoppedBySessionDisconnect | Stopped by session disconnect |
kFPWCSStreamStatusInfoStoppedByRestTerminate | Stopped by rest /terminate |
kFPWCSStreamStatusInfoStoppedByPublisherStop | Stopped by publisher stop |
kFPWCSStreamStatusInfoStoppedByUser | Stopped by user |
kFPWCSStreamStatusInfoFailedByError | Failed by error |
kFPWCSStreamStatusInfoFailedToAddStreamToProxy | Failed to add stream to proxy |
kFPWCSStreamStatusInfoDistributorStopped | Distributor stopped |
kFPWCSStreamStatusInfoPublishStreamIsNotReady | Publish stream is not ready |
kFPWCSStreamStatusInfoStreamNotFound | Stream not found |
kFPWCSStreamStatusInfoStreamNameAlreadyInUse | Stream name is already in use |
kFPWCSStreamStatusInfoMediasessionIdNull | MediaSessionId is null |
kFPWCSStreamStatusInfoMediasessionIdAlreadyInUse | MediaSessionId is already in use |
kFPWCSStreamStatusInfoSessionNotReady | Session not ready |
kFPWCSStreamStatusInfoSessionDoesNotExist | Session does not exist |
kFPWCSStreamStatusInfoRtspHasWrongFormat | Rtsp has wrong format |
kFPWCSStreamStatusInfoFileHasWrongFormat | File has wrong format |
kFPWCSStreamStatusInfoFailedToConnectToRtspStream | Failed to connect to rtsp stream |
kFPWCSStreamStatusInfoRtspStreamNotFound | Rtsp stream not found |
kFPWCSStreamStatusInfoRtspAgentShutdown | RtspAgent shutdown |
kFPWCSStreamStatusInfoStreamFailed | Stream failed |
kFPWCSStreamStatusInfoNoCommonCodecs | No common codecs |
kFPWCSStreamStatusInfoBadUri | Bad URI |
kFPWCSStreamStatusInfoGotExceptionWhileStreamingFile | Got exception while streaming file |
kFPWCSStreamStatusInfoRequestedStreamShutdown | Requested stream shutdown |
kFPWCSStreamStatusInfoFailedToReadFile | Failed to read file |
kFPWCSStreamStatusInfoFileNotFound | File not found |
kFPWCSStreamStatusInfoFailedToConnectToOriginStream | Failed to connect to origin stream |
kFPWCSStreamStatusInfoCdnStreamNotFound | CDN stream not found |
kFPWCSStreamStatusInfoFailedToGetAgentStorage | Failed to get agent storage |
kFPWCSStreamStatusInfoAgentServicingOriginStreamIsShuttingDown | Agent servicing origin stream is shutting down |
kFPWCSStreamStatusInfoTerminatedByKeepAlive | Terminated by keep-alive |
kFPWCSStreamStatusInfoTranscodingRequiredButDisabled | Transcoding is required, but disabled |
kFPWCSCallStatusInfo | |
kFPWCSCallStatusInfoNormalCallClearing | Normal call hangup |
kFPWCSCallStatusInfoFailedBySessionCreation | Failed by session creation |
kFPWCSCallStatusInfoFailedByIceError | Failed by ICE error |
kFPWCSCallStatusInfoFailedByRtpActivity | Failed by RTP activity |
kFPWCSCallStatusInfoFailedByRtmpWriterError | Failed by RTMP writer error |
kFPWCSCallStatusInfoFailedByDtlsFingerprintError | Failed by DTLS fingerprint error |
kFPWCSCallStatusInfoFailedByDtlsError | Failed by DTLS error |
kFPWCSCallStatusInfoFailedByError | Failed by error |
kFPWCSCallStatusInfoFailedByRequestTimeout | Failed by request timeout |
kFPWCSCallStatusInfoTranscodingRequiredButDisabled | Transcoding is required, but disabled |
Error handling code example
As an example. let's take the Two Way Streaming example code, implementation file ViewController.m
1. Stream publishing and playback error handling
FPWCSApi2Model streamStatusToString(), stream getStatus(), stream getStatusInfo()
view.text = [FPWCSApi2Model streamStatusToString:[stream getStatus]]; switch ([stream getStatus]) { case kFPWCSStreamStatusFailed: { view.textColor = [UIColor redColor]; switch ([stream getStatusInfo]) { case kFPWCSStreamStatusInfoSessionDoesNotExist: view.text = @"Actual session does not exist"; break; case kFPWCSStreamStatusInfoStoppedByPublisherStop: view.text = @"Related publisher stopped its stream or lost connection"; break; case kFPWCSStreamStatusInfoSessionNotReady: view.text = @"Session is not initialized or terminated on play ordinary stream"; break; case kFPWCSStreamStatusInfoRtspStreamNotFound: view.text = @"Rtsp stream is not found, agent received '404-Not Found'"; break; case kFPWCSStreamStatusInfoFailedToConnectToRtspStream: view.text = @"Failed to connect to rtsp stream"; break; case kFPWCSStreamStatusInfoFileNotFound: view.text = @"File does not exist, check filename"; break; case kFPWCSStreamStatusInfoFileHasWrongFormat: view.text = @"Failed to play vod stream, this format is not supported"; break; case kFPWCSStreamStatusInfoStreamNameAlreadyInUse: view.text = @"Server already has a publish stream with the same name, try using different one"; break; } break; } ... }