Class WebRtcProtocolHandler
java.lang.Object
com.openfin.desktop.channel.AbstractProtocolHandler
com.openfin.desktop.channel.webrtc.WebRtcProtocolHandler
- All Implemented Interfaces:
DataChannelListener
,EventListener
,dev.onvoid.webrtc.PeerConnectionObserver
public class WebRtcProtocolHandler extends AbstractProtocolHandler implements dev.onvoid.webrtc.PeerConnectionObserver, EventListener, DataChannelListener
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.openfin.desktop.channel.webrtc.DataChannelListener
DataChannelListener.State
-
Field Summary
Fields Modifier and Type Field Description protected dev.onvoid.webrtc.RTCPeerConnection
peerConnection
Fields inherited from class com.openfin.desktop.channel.AbstractProtocolHandler
channel, clientEndpointIdentity, endpointIdentity, isProvider, logger
-
Constructor Summary
Constructors Constructor Description WebRtcProtocolHandler(Channel channel)
-
Method Summary
Modifier and Type Method Description protected void
acceptAnswer(org.json.JSONObject answer, java.util.concurrent.CompletableFuture<java.lang.Boolean> future)
Accept answer from a channel providerprotected void
acceptOffer(org.json.JSONObject payload)
protected void
cleanup()
protected dev.onvoid.webrtc.RTCSessionDescription
createAnswer()
void
eventReceived(ActionEvent actionEvent)
Invoked when registered event occursProtocolOptions
getProtocolOptions()
protected org.json.JSONObject
getSupportedAnswerProtocol()
protected org.json.JSONObject
getSupportedOfferProtocol()
void
initializeClient()
void
onAddStream(dev.onvoid.webrtc.media.MediaStream stream)
void
onAddTrack(dev.onvoid.webrtc.RTCRtpReceiver receiver, dev.onvoid.webrtc.media.MediaStream[] mediaStreams)
void
onConnectionChange(dev.onvoid.webrtc.RTCPeerConnectionState state)
void
onDataChannel(dev.onvoid.webrtc.RTCDataChannel dataChannel)
void
onIceCandidate(dev.onvoid.webrtc.RTCIceCandidate rtcIceCandidate)
void
onIceCandidateError(dev.onvoid.webrtc.RTCPeerConnectionIceErrorEvent event)
void
onIceCandidatesRemoved(dev.onvoid.webrtc.RTCIceCandidate[] candidates)
void
onIceConnectionChange(dev.onvoid.webrtc.RTCIceConnectionState state)
void
onIceConnectionReceivingChange(boolean receiving)
void
onIceGatheringChange(dev.onvoid.webrtc.RTCIceGatheringState state)
void
onMessage(DataChannel source, java.lang.String message)
void
onRemoveStream(dev.onvoid.webrtc.media.MediaStream stream)
void
onRemoveTrack(dev.onvoid.webrtc.RTCRtpReceiver receiver)
void
onRenegotiationNeeded()
void
onSignalingChange(dev.onvoid.webrtc.RTCSignalingState state)
void
onStandardizedIceConnectionChange(dev.onvoid.webrtc.RTCIceConnectionState state)
void
onStateChange(DataChannel source, DataChannelListener.State state)
void
onTrack(dev.onvoid.webrtc.RTCRtpTransceiver transceiver)
void
sendChannelMessage(java.lang.String action, org.json.JSONObject destionationIdentity, org.json.JSONObject providerIdentity, org.json.JSONObject actionPayload, AckListener ackListener)
java.util.concurrent.CompletableFuture<Ack>
sendChannelMessageAsync(java.lang.String action, org.json.JSONObject destionationIdentity, org.json.JSONObject providerIdentity, java.lang.Object actionPayload)
Methods inherited from class com.openfin.desktop.channel.AbstractProtocolHandler
createProtocolHandler, getChannel, getChannelConnectPayload, getChannelCreatePayload, getOfferProtocolByType, initializeProvider, processConnectAnswer, processConnectOffer, setClientEndpointIdentity
-
Field Details
-
peerConnection
protected dev.onvoid.webrtc.RTCPeerConnection peerConnection
-
-
Constructor Details
-
Method Details
-
getProtocolOptions
- Overrides:
getProtocolOptions
in classAbstractProtocolHandler
-
initializeClient
public void initializeClient() throws java.lang.Exception- Overrides:
initializeClient
in classAbstractProtocolHandler
- Throws:
java.lang.Exception
-
getSupportedOfferProtocol
protected org.json.JSONObject getSupportedOfferProtocol()- Overrides:
getSupportedOfferProtocol
in classAbstractProtocolHandler
-
acceptAnswer
protected void acceptAnswer(org.json.JSONObject answer, java.util.concurrent.CompletableFuture<java.lang.Boolean> future) throws java.lang.ExceptionAccept answer from a channel provider- Overrides:
acceptAnswer
in classAbstractProtocolHandler
- Parameters:
answer
- answer objectfuture
- future for returning true if accepted- Throws:
java.lang.Exception
- Exception
-
acceptOffer
protected void acceptOffer(org.json.JSONObject payload) throws java.lang.Exception- Overrides:
acceptOffer
in classAbstractProtocolHandler
- Throws:
java.lang.Exception
-
getSupportedAnswerProtocol
protected org.json.JSONObject getSupportedAnswerProtocol()- Overrides:
getSupportedAnswerProtocol
in classAbstractProtocolHandler
-
createAnswer
protected dev.onvoid.webrtc.RTCSessionDescription createAnswer() throws java.lang.Exception- Throws:
java.lang.Exception
-
sendChannelMessage
public void sendChannelMessage(java.lang.String action, org.json.JSONObject destionationIdentity, org.json.JSONObject providerIdentity, org.json.JSONObject actionPayload, AckListener ackListener)- Overrides:
sendChannelMessage
in classAbstractProtocolHandler
-
sendChannelMessageAsync
public java.util.concurrent.CompletableFuture<Ack> sendChannelMessageAsync(java.lang.String action, org.json.JSONObject destionationIdentity, org.json.JSONObject providerIdentity, java.lang.Object actionPayload)- Overrides:
sendChannelMessageAsync
in classAbstractProtocolHandler
-
onSignalingChange
public void onSignalingChange(dev.onvoid.webrtc.RTCSignalingState state)- Specified by:
onSignalingChange
in interfacedev.onvoid.webrtc.PeerConnectionObserver
-
onConnectionChange
public void onConnectionChange(dev.onvoid.webrtc.RTCPeerConnectionState state)- Specified by:
onConnectionChange
in interfacedev.onvoid.webrtc.PeerConnectionObserver
-
onIceConnectionChange
public void onIceConnectionChange(dev.onvoid.webrtc.RTCIceConnectionState state)- Specified by:
onIceConnectionChange
in interfacedev.onvoid.webrtc.PeerConnectionObserver
-
onStandardizedIceConnectionChange
public void onStandardizedIceConnectionChange(dev.onvoid.webrtc.RTCIceConnectionState state)- Specified by:
onStandardizedIceConnectionChange
in interfacedev.onvoid.webrtc.PeerConnectionObserver
-
onIceConnectionReceivingChange
public void onIceConnectionReceivingChange(boolean receiving)- Specified by:
onIceConnectionReceivingChange
in interfacedev.onvoid.webrtc.PeerConnectionObserver
-
onIceGatheringChange
public void onIceGatheringChange(dev.onvoid.webrtc.RTCIceGatheringState state)- Specified by:
onIceGatheringChange
in interfacedev.onvoid.webrtc.PeerConnectionObserver
-
onIceCandidate
public void onIceCandidate(dev.onvoid.webrtc.RTCIceCandidate rtcIceCandidate)- Specified by:
onIceCandidate
in interfacedev.onvoid.webrtc.PeerConnectionObserver
-
onIceCandidateError
public void onIceCandidateError(dev.onvoid.webrtc.RTCPeerConnectionIceErrorEvent event)- Specified by:
onIceCandidateError
in interfacedev.onvoid.webrtc.PeerConnectionObserver
-
onIceCandidatesRemoved
public void onIceCandidatesRemoved(dev.onvoid.webrtc.RTCIceCandidate[] candidates)- Specified by:
onIceCandidatesRemoved
in interfacedev.onvoid.webrtc.PeerConnectionObserver
-
onAddStream
public void onAddStream(dev.onvoid.webrtc.media.MediaStream stream)- Specified by:
onAddStream
in interfacedev.onvoid.webrtc.PeerConnectionObserver
-
onRemoveStream
public void onRemoveStream(dev.onvoid.webrtc.media.MediaStream stream)- Specified by:
onRemoveStream
in interfacedev.onvoid.webrtc.PeerConnectionObserver
-
onDataChannel
public void onDataChannel(dev.onvoid.webrtc.RTCDataChannel dataChannel)- Specified by:
onDataChannel
in interfacedev.onvoid.webrtc.PeerConnectionObserver
-
onRenegotiationNeeded
public void onRenegotiationNeeded()- Specified by:
onRenegotiationNeeded
in interfacedev.onvoid.webrtc.PeerConnectionObserver
-
onAddTrack
public void onAddTrack(dev.onvoid.webrtc.RTCRtpReceiver receiver, dev.onvoid.webrtc.media.MediaStream[] mediaStreams)- Specified by:
onAddTrack
in interfacedev.onvoid.webrtc.PeerConnectionObserver
-
onRemoveTrack
public void onRemoveTrack(dev.onvoid.webrtc.RTCRtpReceiver receiver)- Specified by:
onRemoveTrack
in interfacedev.onvoid.webrtc.PeerConnectionObserver
-
onTrack
public void onTrack(dev.onvoid.webrtc.RTCRtpTransceiver transceiver)- Specified by:
onTrack
in interfacedev.onvoid.webrtc.PeerConnectionObserver
-
eventReceived
Description copied from interface:EventListener
Invoked when registered event occurs- Specified by:
eventReceived
in interfaceEventListener
- Parameters:
actionEvent
- Event object- See Also:
ActionEvent
-
onStateChange
- Specified by:
onStateChange
in interfaceDataChannelListener
-
onMessage
- Specified by:
onMessage
in interfaceDataChannelListener
-
cleanup
protected void cleanup()- Overrides:
cleanup
in classAbstractProtocolHandler
-