我收到一条错误消息,指出RTCPeerConnectionObserver不符合协议RTCPeerConnectionDelegate。我错过了什么吗?
这里是RTCPeerConnectionDelegate:
#import <Foundation/Foundation.h>
#import "RTCTypes.h"
@class RTCDataChannel;
@class RTCICECandidate;
@class RTCMediaStream;
@class RTCPeerConnection;
// RTCPeerConnectionDelegate is a protocol for an object that must be
// implemented to get messages from PeerConnection.
@protocol RTCPeerConnectionDelegate<NSObject>
// Triggered when there is an error.
- (void)peerConnectionOnError:(RTCPeerConnection *)peerConnection;
// Triggered when the SignalingState changed.
- (void)peerConnection:(RTCPeerConnection *)peerConnection
signalingStateChanged:(RTCSignalingState)stateChanged;
// Triggered when media is received on a new stream from remote peer.
- (void)peerConnection:(RTCPeerConnection *)peerConnection
addedStream:(RTCMediaStream *)stream;
// Triggered when a remote peer close a stream.
- (void)peerConnection:(RTCPeerConnection *)peerConnection
removedStream:(RTCMediaStream *)stream;
// Triggered when renegotiation is needed, for example the ICE has restarted.
- (void)peerConnectionOnRenegotiationNeeded:(RTCPeerConnection *)peerConnection;
// Called any time the ICEConnectionState changes.
- (void)peerConnection:(RTCPeerConnection *)peerConnection
iceConnectionChanged:(RTCICEConnectionState)newState;
// Called any time the ICEGatheringState changes.
- (void)peerConnection:(RTCPeerConnection *)peerConnection
iceGatheringChanged:(RTCICEGatheringState)newState;
// New Ice candidate have been found.
- (void)peerConnection:(RTCPeerConnection *)peerConnection
gotICECandidate:(RTCICECandidate *)candidate;
// New data channel has been opened.
- (void)peerConnection:(RTCPeerConnection*)peerConnection
didOpenDataChannel:(RTCDataChannel*)dataChannel;
@end
这里是RTCPeerConnectionObserver:
import Foundation
class RTCPeerConnectionObserver: NSObject, RTCPeerConnectionDelegate {
var websocketConnection: WebsocketConnection
init(websocketConnection: WebsocketConnection) {
self.websocketConnection = websocketConnection
}
func peerConnectionOnError(peerConnection: RTCPeerConnection!) {
}
func peerConnection(peerConnection: RTCPeerConnection!, iceConnectionChanged newState: RTCICEConnectionState) {
}
func peerConnection(peerConnection: RTCPeerConnection!, iceGatheringChanged newState: RTCICEGatheringState) {
}
func peerConnection(peerConnection: RTCPeerConnection!, signalingStateChanged stateChanged: RTCSignalingState) {
}
func peerConnectionOnRenegotiationNeeded(peerConnection: RTCPeerConnection!) {
}
func peerConnection(peerConnection: RTCPeerConnection!, addedStream stream: RTCMediaStream!) {
}
func peerConnection(peerConnection: RTCPeerConnection!, removedStream stream: RTCMediaStream!) {
}
func peerConnection(peerConnection: RTCPeerConnection!, gotICECandidate candidate: RTCICECandidate!) {
}
}