🌐 한국어

    WebRTC API#

    Oasis는 WebRTC 영상과 음성(SRTP), 데이터 채널(SCTP)을 지원합니다.

    NAT Traversal을 위한 ICE를 지원합니다.

    헤더 파일#

    OasisWebRTC.h

    RTCPeerConnectionEventDelegate 인터페이스#

    class RTCPeerConnectionEventDelegate : public std::enable_shared_from_this<RTCPeerConnectionEventDelegate>
    {
    public:
        RTCPeerConnectionEventDelegate();
        virtual ~RTCPeerConnectionEventDelegate();
    
        virtual void onSessionCreated(const RTCPeerConnectionRef &pc, const char *local_sid, const char *remote_sid, int64_t session_id, void *opaque);
        virtual void onSessionDestroyed(const RTCPeerConnectionRef &pc, const char *local_sid, const char *remote_sid, int64_t session_id, void *opaque);
        virtual void onConnectionTimedOut(const RTCPeerConnectionRef &pc, const char *local_sid, const char *remote_sid, int64_t session_id, void *opaque);
        virtual void onLocalOffer(const RTCPeerConnectionRef &pc, const char *local_sid, const char *remote_sid, const char *local_offer);
        virtual void onLocalAnswer(const RTCPeerConnectionRef &pc, const char *local_sid, const char *remote_sid, const char *local_answer);
        virtual void onNewLocalCandidate(const RTCPeerConnectionRef &pc, const char *local_sid, const char *remote_sid, const char *mid, const char *local_candidate);
        virtual void onError(const RTCPeerConnectionRef &pc, const char *local_sid, const char *remote_sid, int32_t error, int32_t reason, const char *reason_msg);
    
        virtual void onLocalDataChannelOpened(const RTCPeerConnectionRef &pc, const RTCDataChannelRef &dc);
        virtual void onLocalDataChannelClosed(const RTCPeerConnectionRef &pc, const RTCDataChannelRef &dc);
    
        virtual void onPeerDataChannelOpen(const RTCPeerConnectionRef &pc, const RTCDataChannelRef &dc);
        virtual void onPeerDataChannelClosed(const RTCPeerConnectionRef &pc, const RTCDataChannelRef &dc);
        virtual void onPeerDataChannelString(const RTCPeerConnectionRef &pc, const RTCDataChannelRef &dc, const std::string &string, uint32_t flags);
        virtual void onPeerDataChannelBinary(const RTCPeerConnectionRef &pc, const RTCDataChannelRef &dc, const void *data, size_t length, uint32_t flags);
        virtual void onPeerDataChannelError(const RTCPeerConnectionRef &pc, const RTCDataChannelRef &dc, int32_t error, int32_t reason, const char *reason_msg);
    
        virtual void onPeerImageReady(const RTCPeerConnectionRef &pc, const char *camera_path);
    };
    
    void onSessionCreated ( const RTCPeerConnectionRef & pc , const char * local_sid , const char * remote_sid , int64_t session_id , void * opaque )
    OasisWebRTC.h
    WebRTC 세션이 생성되었을 때 발생하는 이벤트 호출 콜백 함수입니다.
    매개변수
    pc  WebRTC 연결 객체입니다.
    local_sid  로컬 ID를 가리키는 문자열 포인터입니다.
    remote_sid  원격 ID를 가리키는 문자열 포인터입니다.
    session_id  세션 ID 입니다.
    opaque  내부용 포인터입니다.
    void onSessionDestroyed ( const RTCPeerConnectionRef & pc , const char * local_sid , const char * remote_sid , int64_t session_id , void * opaque )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    local_sid 
    remote_sid 
    session_id 
    opaque 
    void onConnectionTimedOut ( const RTCPeerConnectionRef & pc , const char * local_sid , const char * remote_sid , int64_t session_id , void * opaque )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    local_sid 
    remote_sid 
    session_id 
    opaque 
    void onLocalOffer ( const RTCPeerConnectionRef & pc , const char * local_sid , const char * remote_sid , const char * local_offer )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    local_sid 
    remote_sid 
    local_offer 
    void onLocalAnswer ( const RTCPeerConnectionRef & pc , const char * local_sid , const char * remote_sid , const char * local_answer )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    local_sid 
    remote_sid 
    local_answer 
    void onNewLocalCandidate ( const RTCPeerConnectionRef & pc , const char * local_sid , const char * remote_sid , const char * mid , const char * local_candidate )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    local_sid 
    remote_sid 
    mid 
    local_candidate 
    void onError ( const RTCPeerConnectionRef & pc , const char * local_sid , const char * remote_sid , int32_t error , int32_t reason , const char * reason_msg )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    local_sid 
    remote_sid 
    error 
    reason 
    reason_msg 
    void onLocalDataChannelOpened ( const RTCPeerConnectionRef & pc , const RTCDataChannelRef & dc )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    dc 
    void onLocalDataChannelClosed ( const RTCPeerConnectionRef & pc , const RTCDataChannelRef & dc )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    dc 
    void onPeerDataChannelOpen ( const RTCPeerConnectionRef & pc , const RTCDataChannelRef & dc )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    dc 
    void onPeerDataChannelClosed ( const RTCPeerConnectionRef & pc , const RTCDataChannelRef & dc )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    dc 
    void onPeerDataChannelString ( const RTCPeerConnectionRef & pc , const RTCDataChannelRef & dc , const std::string & string , uint32_t flags )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    dc 
    string 
    flags 
    void onPeerDataChannelBinary ( const RTCPeerConnectionRef & pc , const RTCDataChannelRef & dc , const void * data , size_t length , uint32_t flags )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    dc 
    data 
    length 
    flags 
    void onPeerDataChannelError ( const RTCPeerConnectionRef & pc , const RTCDataChannelRef & dc , int32_t error , int32_t reason , const char * reason_msg )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    dc 
    error 
    reason 
    reason_msg 
    void onPeerImageReady ( const RTCPeerConnectionRef & pc , const char * camera_path )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    camera_path 

    함수#

    RTCPeerConnectionRef rtcPeerConnectionCreate ( key_value_map_t & session_parameters , const std::shared_ptr<RTCPeerConnectionEventDelegate> & delegate )
    OasisWebRTC.h
    매개변수
    session_parameters 
    delegate 
    리턴값
    int32_t rtcPeerConnectionDestroy ( const RTCPeerConnectionRef & pc )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    리턴값
    • 0: 성공
    • -1: 실패
    int32_t rtcPeerConnectionSetLocalSid ( const RTCPeerConnectionRef & pc , const char * local_sid )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    local_sid 
    리턴값
    • 0: 성공
    • -1: 실패
    bool rtcPeerConnectionIsBusy ( const RTCPeerConnectionRef & pc )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    리턴값
    int32_t rtcPeerConnectionSetRemoteAnswer ( const RTCPeerConnectionRef & pc , const char * local_sid , const char * remote_sid , const char * answer_sdp )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    local_sid 
    remote_sid 
    answer_sdp 
    리턴값
    • 0: 성공
    • -1: 실패
    int32_t rtcPeerConnectionSetRemoteOffer ( const RTCPeerConnectionRef & pc , const char * local_sid , const char * remote_sid , const char * offer_sdp , bool always_create )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    local_sid 
    remote_sid 
    offer_sdp 
    always_create 
    리턴값
    • 0: 성공
    • -1: 실패
    int32_t rtcPeerConnectionAddRemoteCandidate ( const RTCPeerConnectionRef & pc , const char * local_sid , const char * remote_sid , const char * mid , const char * remote_candidate )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    local_sid 
    remote_sid 
    mid 
    remote_candidate 
    리턴값
    • 0: 성공
    • -1: 실패
    int32_t rtcPeerConnectionCreateSession ( const RTCPeerConnectionRef & pc , const char * from_sid )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    from_sid 
    리턴값
    • 0: 성공
    • -1: 실패
    int32_t rtcPeerConnectionCreateSessionWithParameters ( const RTCPeerConnectionRef & pc , const char * from_sid , const key_value_map_t & parameters )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    from_sid 
    parameters 
    리턴값
    • 0: 성공
    • -1: 실패
    int32_t rtcPeerConnectionDestroySession ( const RTCPeerConnectionRef & pc , const char * local_sid , const char * remote_sid )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    local_sid 
    remote_sid 
    리턴값
    • 0: 성공
    • -1: 실패
    int32_t rtcPeerConnectionMuteSoundSink ( const RTCPeerConnectionRef & pc , bool on )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    on 
    리턴값
    • 0: 성공
    • -1: 실패
    int32_t rtcPeerConnectionMuteSoundSource ( const RTCPeerConnectionRef & pc , bool on )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    on 
    리턴값
    • 0: 성공
    • -1: 실패
    RTCDataChannelRef rtcCreateDataChannel ( const RTCPeerConnectionRef & pc , const char * label )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    label 
    리턴값
    int32_t rtcDestroyDataChannel ( const RTCPeerConnectionRef & pc , const char * label )
    OasisWebRTC.h
    매개변수
    pc  WebRTC 연결 객체입니다.
    label 
    리턴값
    • 0: 성공
    • -1: 실패
    uint16_t rtcDataChannelStreamID ( const RTCDataChannelRef & dc )
    OasisWebRTC.h
    매개변수
    dc 
    리턴값
    const char * rtcDataChannelLabel ( const RTCDataChannelRef & dc )
    OasisWebRTC.h
    매개변수
    dc 
    리턴값
    const char * rtcDataChannelProtocol ( const RTCDataChannelRef & dc )
    OasisWebRTC.h
    매개변수
    dc 
    리턴값
    ssize_t rtcDataChannelSendString ( const RTCDataChannelRef & dc , const std::string & string , uint32_t flags )
    OasisWebRTC.h
    매개변수
    dc 
    string 
    flags 
    리턴값
    ssize_t rtcDataChannelSendString ( const RTCDataChannelRef & dc , const char * string , size_t length , uint32_t flags )
    OasisWebRTC.h
    매개변수
    dc 
    string 
    length 
    flags 
    리턴값
    ssize_t rtcDataChannelSendBinary ( const RTCDataChannelRef & dc , const std::vector<uint8_t> & data , uint32_t flags )
    OasisWebRTC.h
    매개변수
    dc 
    data 
    flags 
    리턴값
    ssize_t rtcDataChannelSendBinary ( const RTCDataChannelRef & dc , const std::vector<char> & data , uint32_t flags )
    OasisWebRTC.h
    매개변수
    dc 
    data 
    flags 
    리턴값
    ssize_t rtcDataChannelSendBinary ( const RTCDataChannelRef & dc , const void * data , size_t length , uint32_t flags )
    OasisWebRTC.h
    매개변수
    dc 
    data 
    length 
    flags 
    리턴값

    예제#