mirror of
https://github.com/pion/webrtc.git
synced 2025-12-24 11:51:03 +08:00
Implement JSValue for more structures
Previously was only implemented for PeerConnection.
This commit is contained in:
@@ -36,6 +36,11 @@ type DataChannel struct {
|
||||
api *API
|
||||
}
|
||||
|
||||
// JSValue returns the underlying RTCDataChannel
|
||||
func (d *DataChannel) JSValue() js.Value {
|
||||
return d.underlying
|
||||
}
|
||||
|
||||
// OnOpen sets an event handler which is invoked when
|
||||
// the underlying data transport has been established (or re-established).
|
||||
func (d *DataChannel) OnOpen(f func()) {
|
||||
|
||||
@@ -17,6 +17,11 @@ type DTLSTransport struct {
|
||||
underlying js.Value
|
||||
}
|
||||
|
||||
// JSValue returns the underlying RTCDtlsTransport
|
||||
func (r *DTLSTransport) JSValue() js.Value {
|
||||
return r.underlying
|
||||
}
|
||||
|
||||
// ICETransport returns the currently-configured *ICETransport or nil
|
||||
// if one has not been configured
|
||||
func (r *DTLSTransport) ICETransport() *ICETransport {
|
||||
|
||||
@@ -15,6 +15,11 @@ type ICETransport struct {
|
||||
underlying js.Value
|
||||
}
|
||||
|
||||
// JSValue returns the underlying RTCIceTransport
|
||||
func (t *ICETransport) JSValue() js.Value {
|
||||
return t.underlying
|
||||
}
|
||||
|
||||
// GetSelectedCandidatePair returns the selected candidate pair on which packets are sent
|
||||
// if there is no selected pair nil is returned
|
||||
func (t *ICETransport) GetSelectedCandidatePair() (*ICECandidatePair, error) {
|
||||
|
||||
@@ -13,3 +13,8 @@ type RTPReceiver struct {
|
||||
// Pointer to the underlying JavaScript RTCRTPReceiver object.
|
||||
underlying js.Value
|
||||
}
|
||||
|
||||
// JSValue returns the underlying RTCRtpReceiver
|
||||
func (r *RTPReceiver) JSValue() js.Value {
|
||||
return r.underlying
|
||||
}
|
||||
@@ -13,3 +13,8 @@ type RTPSender struct {
|
||||
// Pointer to the underlying JavaScript RTCRTPSender object.
|
||||
underlying js.Value
|
||||
}
|
||||
|
||||
// JSValue returns the underlying RTCRtpSender
|
||||
func (s *RTPSender) JSValue() js.Value {
|
||||
return s.underlying
|
||||
}
|
||||
|
||||
@@ -16,6 +16,11 @@ type RTPTransceiver struct {
|
||||
underlying js.Value
|
||||
}
|
||||
|
||||
// JSValue returns the underlying RTCRtpTransceiver
|
||||
func (r *RTPTransceiver) JSValue() js.Value {
|
||||
return r.underlying
|
||||
}
|
||||
|
||||
// Direction returns the RTPTransceiver's current direction
|
||||
func (r *RTPTransceiver) Direction() RTPTransceiverDirection {
|
||||
return NewRTPTransceiverDirection(r.underlying.Get("direction").String())
|
||||
|
||||
@@ -14,6 +14,11 @@ type SCTPTransport struct {
|
||||
underlying js.Value
|
||||
}
|
||||
|
||||
// JSValue returns the underlying RTCSctpTransport
|
||||
func (r *SCTPTransport) JSValue() js.Value {
|
||||
return r.underlying
|
||||
}
|
||||
|
||||
// Transport returns the DTLSTransport instance the SCTPTransport is sending over.
|
||||
func (r *SCTPTransport) Transport() *DTLSTransport {
|
||||
underlying := r.underlying.Get("transport")
|
||||
|
||||
Reference in New Issue
Block a user