Skip to end of metadata
Go to start of metadata

При получении статуса потока 'kFPWCSStreamStatusFailed', метод stream getStatusInfo возвращает код возникшей ошибки, который может быть преобразован в текстовое описание при помощи метода streamStatusToString. Аналогичным образом обрабатываются и ошибки при совершении звонка.

Список ошибок

ОшибкаТекстовое описание
kFPWCSStreamStatusInfo
kFPWCSStreamStatusInfoFailedByIceErrorFailed by ICE error
kFPWCSStreamStatusInfoFailedByIceTimeoutFailed by ICE timeout
kFPWCSStreamStatusInfoFailedByKeepAliveFailed by ICE keep alive
kFPWCSStreamStatusInfoFailedByDtlsFingerprintErrorFailed by DTLS fingerprint error
kFPWCSStreamStatusInfoFailedByDtlsErrorFailed by DTLS error
kFPWCSStreamStatusInfoFailedByHlsWriterErrorFailed by HLS writer error
FPWCSStreamStatusInfoFailedByRtmpWriterErrorFailed by RTMP writer error
kFPWCSStreamStatusInfoFailedByRtpActivityFailed by RTP activity
kFPWCSStreamStatusInfoStoppedBySessionDisconnectStopped by session disconnect
kFPWCSStreamStatusInfoStoppedByRestTerminateStopped by rest /terminate
kFPWCSStreamStatusInfoStoppedByPublisherStopStopped by publisher stop
kFPWCSStreamStatusInfoStoppedByUserStopped by user
kFPWCSStreamStatusInfoFailedByErrorFailed by error
kFPWCSStreamStatusInfoFailedToAddStreamToProxyFailed to add stream to proxy
kFPWCSStreamStatusInfoDistributorStoppedDistributor stopped
kFPWCSStreamStatusInfoPublishStreamIsNotReadyPublish stream is not ready
kFPWCSStreamStatusInfoStreamNotFoundStream not found
kFPWCSStreamStatusInfoStreamNameAlreadyInUseStream name is already in use
kFPWCSStreamStatusInfoMediasessionIdNullMediaSessionId is null
kFPWCSStreamStatusInfoMediasessionIdAlreadyInUseMediaSessionId is already in use
kFPWCSStreamStatusInfoSessionNotReadySession not ready
kFPWCSStreamStatusInfoSessionDoesNotExistSession does not exist
kFPWCSStreamStatusInfoRtspHasWrongFormatRtsp has wrong format
kFPWCSStreamStatusInfoFileHasWrongFormatFile has wrong format
kFPWCSStreamStatusInfoFailedToConnectToRtspStreamFailed to connect to rtsp stream
kFPWCSStreamStatusInfoRtspStreamNotFoundRtsp stream not found
kFPWCSStreamStatusInfoRtspAgentShutdownRtspAgent shutdown
kFPWCSStreamStatusInfoStreamFailedStream failed
kFPWCSStreamStatusInfoNoCommonCodecsNo common codecs
kFPWCSStreamStatusInfoBadUriBad URI
kFPWCSStreamStatusInfoGotExceptionWhileStreamingFileGot exception while streaming file
kFPWCSStreamStatusInfoRequestedStreamShutdownRequested stream shutdown
kFPWCSStreamStatusInfoFailedToReadFileFailed to read file
kFPWCSStreamStatusInfoFileNotFoundFile not found
kFPWCSStreamStatusInfoFailedToConnectToOriginStreamFailed to connect to origin stream
kFPWCSStreamStatusInfoCdnStreamNotFoundCDN stream not found
kFPWCSStreamStatusInfoFailedToGetAgentStorageFailed to get agent storage
kFPWCSStreamStatusInfoAgentServicingOriginStreamIsShuttingDownAgent servicing origin stream is shutting down
kFPWCSStreamStatusInfoTerminatedByKeepAliveTerminated by keep-alive
kFPWCSStreamStatusInfoTranscodingRequiredButDisabledTranscoding is required, but disabled
kFPWCSCallStatusInfo
kFPWCSCallStatusInfoNormalCallClearingNormal call hangup
kFPWCSCallStatusInfoFailedBySessionCreationFailed by session creation
kFPWCSCallStatusInfoFailedByIceErrorFailed by ICE error
kFPWCSCallStatusInfoFailedByRtpActivityFailed by RTP activity
kFPWCSCallStatusInfoFailedByRtmpWriterErrorFailed by RTMP writer error
kFPWCSCallStatusInfoFailedByDtlsFingerprintErrorFailed by DTLS fingerprint error
kFPWCSCallStatusInfoFailedByDtlsErrorFailed by DTLS error
kFPWCSCallStatusInfoFailedByErrorFailed by error
kFPWCSCallStatusInfoFailedByRequestTimeoutFailed by request timeout
kFPWCSCallStatusInfoTranscodingRequiredButDisabledTranscoding is required, but disabled

Пример кода обработки ошибок

В качестве примера рассмотрим код примера Two Way Streaming, файл имплементации ViewController.m

1. Обработка ошибок при публикации и воспроизведении потока

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;
        }
        ...
    }
  • No labels