@videosdk.live/react-sdk
Advanced tools
Comparing version 0.1.42 to 0.1.43
@@ -36,3 +36,4 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
'recording-state-changed': eventPrifix + "-recording-state-changed", | ||
'livestream-state-changed': eventPrifix + "-livestream-state-changed" | ||
'livestream-state-changed': eventPrifix + "-livestream-state-changed", | ||
'meeting-state-changed': eventPrifix + "-meeting-state-changed" | ||
}; | ||
@@ -98,3 +99,5 @@ var eventEmitter = new EventEmitter(); | ||
_ref$onLivestreamStat = _ref.onLivestreamStateChanged, | ||
onLivestreamStateChanged = _ref$onLivestreamStat === void 0 ? function () {} : _ref$onLivestreamStat; | ||
onLivestreamStateChanged = _ref$onLivestreamStat === void 0 ? function () {} : _ref$onLivestreamStat, | ||
_ref$onMeetingStateCh = _ref.onMeetingStateChanged, | ||
onMeetingStateChanged = _ref$onMeetingStateCh === void 0 ? function () {} : _ref$onMeetingStateCh; | ||
@@ -129,3 +132,5 @@ React.useEffect(function () { | ||
eventEmitter.on(events['livestream-state-changed'], onLivestreamStateChanged); | ||
eventEmitter.on(events['meeting-state-changed'], onMeetingStateChanged); | ||
return function () { | ||
eventEmitter.off(events['meeting-state-changed'], onMeetingStateChanged); | ||
eventEmitter.off(events['participant-joined'], onParticipantJoined); | ||
@@ -217,4 +222,7 @@ eventEmitter.off(events['participant-left'], onParticipantLeft); | ||
_ref2$onLivestreamSta = _ref2.onLivestreamStateChanged, | ||
onLivestreamStateChanged = _ref2$onLivestreamSta === void 0 ? function () {} : _ref2$onLivestreamSta; | ||
onLivestreamStateChanged = _ref2$onLivestreamSta === void 0 ? function () {} : _ref2$onLivestreamSta, | ||
_ref2$onMeetingStateC = _ref2.onMeetingStateChanged, | ||
onMeetingStateChanged = _ref2$onMeetingStateC === void 0 ? function () {} : _ref2$onMeetingStateC; | ||
React.useEffect(function () { | ||
eventEmitter.on(events['meeting-state-changed'], onMeetingStateChanged); | ||
eventEmitter.on(events['participant-joined'], onParticipantJoined); | ||
@@ -248,2 +256,3 @@ eventEmitter.on(events['participant-left'], onParticipantLeft); | ||
return function () { | ||
eventEmitter.off(events['meeting-state-changed'], onMeetingStateChanged); | ||
eventEmitter.off(events['participant-joined'], onParticipantJoined); | ||
@@ -281,3 +290,3 @@ eventEmitter.off(events['participant-left'], onParticipantLeft); | ||
var version = "0.1.41"; | ||
var version = "0.1.43"; | ||
@@ -556,2 +565,3 @@ var MeetingProvider = function MeetingProvider(_ref) { | ||
if (typeof (meeting === null || meeting === void 0 ? void 0 : meeting.off) === 'function') { | ||
meeting.off('meeting-state-changed', _handle_meeting_state_changed); | ||
meeting.off('participant-joined', _handle_participant_joined); | ||
@@ -652,2 +662,6 @@ meeting.off('participant-left', _handle_participant_left); | ||
var _handle_meeting_state_changed = function _handle_meeting_state_changed(data) { | ||
eventEmitter.emit(events['meeting-state-changed'], data); | ||
}; | ||
var join = function join() { | ||
@@ -661,2 +675,3 @@ var meeting = jsSdk.VideoSDK && jsSdk.VideoSDK.initMeeting(configRef.current); | ||
setLocalParticipant(localParticipant); | ||
meeting.on('meeting-state-changed', _handle_meeting_state_changed); | ||
meeting.on('participant-joined', _handle_participant_joined); | ||
@@ -1081,3 +1096,5 @@ meeting.on('participant-left', _handle_participant_left); | ||
_ref$onStreamDisabled = _ref.onStreamDisabled, | ||
onStreamDisabled = _ref$onStreamDisabled === void 0 ? function () {} : _ref$onStreamDisabled; | ||
onStreamDisabled = _ref$onStreamDisabled === void 0 ? function () {} : _ref$onStreamDisabled, | ||
_ref$onMediaStatusCha = _ref.onMediaStatusChanged, | ||
onMediaStatusChanged = _ref$onMediaStatusCha === void 0 ? function () {} : _ref$onMediaStatusCha; | ||
@@ -1125,2 +1142,10 @@ var _useState = React.useState(null), | ||
var _useState4 = React.useState(participant === null || participant === void 0 ? void 0 : participant.webcamOn), | ||
webcamOn = _useState4[0], | ||
setWebcamOn = _useState4[1]; | ||
var _useState5 = React.useState(participant === null || participant === void 0 ? void 0 : participant.micOn), | ||
micOn = _useState5[0], | ||
setMicOn = _useState5[1]; | ||
var setTrack = function setTrack(stream) { | ||
@@ -1172,2 +1197,20 @@ if (stream.track.readyState === 'live') { | ||
var _handleMediaStatusChanged = function _handleMediaStatusChanged(data) { | ||
var kind = data.kind, | ||
peerId = data.peerId, | ||
newStatus = data.newStatus; | ||
if (kind == 'audio') { | ||
setMicOn(newStatus); | ||
} else if (kind == 'video') { | ||
setWebcamOn(newStatus); | ||
} | ||
onMediaStatusChanged({ | ||
kind: kind, | ||
peerId: peerId, | ||
newStatus: newStatus | ||
}); | ||
}; | ||
var setQuality = function setQuality(quality) { | ||
@@ -1205,2 +1248,10 @@ participant === null || participant === void 0 ? void 0 : participant.setQuality(quality); | ||
var getAudioStats = function getAudioStats() { | ||
return Promise.resolve(participant === null || participant === void 0 ? void 0 : participant.getAudioStats()); | ||
}; | ||
var getVideoStats = function getVideoStats() { | ||
return Promise.resolve(participant === null || participant === void 0 ? void 0 : participant.getVideoStats()); | ||
}; | ||
var consumeWebcamStreams = function consumeWebcamStreams() { | ||
@@ -1235,7 +1286,17 @@ participant === null || participant === void 0 ? void 0 : participant.consumeWebcamStreams(); | ||
if (participant !== null && participant !== void 0 && participant.micOn) { | ||
setMicOn(micOn); | ||
} | ||
if (participant !== null && participant !== void 0 && participant.webcamOn) { | ||
setWebcamOn(webcamOn); | ||
} | ||
participant === null || participant === void 0 ? void 0 : participant.on('stream-enabled', _handleStreamEnabled); | ||
participant === null || participant === void 0 ? void 0 : participant.on('stream-disabled', _handleStreamDisabled); | ||
participant === null || participant === void 0 ? void 0 : participant.on('media-status-changed', _handleMediaStatusChanged); | ||
return function () { | ||
participant === null || participant === void 0 ? void 0 : participant.off('stream-enabled', _handleStreamEnabled); | ||
participant === null || participant === void 0 ? void 0 : participant.off('stream-disabled', _handleStreamDisabled); | ||
participant === null || participant === void 0 ? void 0 : participant.off('media-status-changed', _handleMediaStatusChanged); | ||
}; | ||
@@ -1249,4 +1310,4 @@ }, [participant]); | ||
screenShareStream: screenShareStream, | ||
webcamOn: !!webcamStream, | ||
micOn: !!micStream, | ||
webcamOn: webcamOn, | ||
micOn: micOn, | ||
screenShareOn: !!screenShareStream, | ||
@@ -1269,3 +1330,5 @@ isLocal: (localParticipant === null || localParticipant === void 0 ? void 0 : localParticipant.id) === participantId, | ||
unpin: unpin, | ||
switchTo: switchTo | ||
switchTo: switchTo, | ||
getAudioStats: getAudioStats, | ||
getVideoStats: getVideoStats | ||
}; | ||
@@ -1272,0 +1335,0 @@ }; |
@@ -33,3 +33,4 @@ import React, { createContext, useEffect, useContext, useState, useRef, useMemo } from 'react'; | ||
'recording-state-changed': eventPrifix + "-recording-state-changed", | ||
'livestream-state-changed': eventPrifix + "-livestream-state-changed" | ||
'livestream-state-changed': eventPrifix + "-livestream-state-changed", | ||
'meeting-state-changed': eventPrifix + "-meeting-state-changed" | ||
}; | ||
@@ -95,3 +96,5 @@ var eventEmitter = new EventEmitter(); | ||
_ref$onLivestreamStat = _ref.onLivestreamStateChanged, | ||
onLivestreamStateChanged = _ref$onLivestreamStat === void 0 ? function () {} : _ref$onLivestreamStat; | ||
onLivestreamStateChanged = _ref$onLivestreamStat === void 0 ? function () {} : _ref$onLivestreamStat, | ||
_ref$onMeetingStateCh = _ref.onMeetingStateChanged, | ||
onMeetingStateChanged = _ref$onMeetingStateCh === void 0 ? function () {} : _ref$onMeetingStateCh; | ||
@@ -126,3 +129,5 @@ useEffect(function () { | ||
eventEmitter.on(events['livestream-state-changed'], onLivestreamStateChanged); | ||
eventEmitter.on(events['meeting-state-changed'], onMeetingStateChanged); | ||
return function () { | ||
eventEmitter.off(events['meeting-state-changed'], onMeetingStateChanged); | ||
eventEmitter.off(events['participant-joined'], onParticipantJoined); | ||
@@ -214,4 +219,7 @@ eventEmitter.off(events['participant-left'], onParticipantLeft); | ||
_ref2$onLivestreamSta = _ref2.onLivestreamStateChanged, | ||
onLivestreamStateChanged = _ref2$onLivestreamSta === void 0 ? function () {} : _ref2$onLivestreamSta; | ||
onLivestreamStateChanged = _ref2$onLivestreamSta === void 0 ? function () {} : _ref2$onLivestreamSta, | ||
_ref2$onMeetingStateC = _ref2.onMeetingStateChanged, | ||
onMeetingStateChanged = _ref2$onMeetingStateC === void 0 ? function () {} : _ref2$onMeetingStateC; | ||
useEffect(function () { | ||
eventEmitter.on(events['meeting-state-changed'], onMeetingStateChanged); | ||
eventEmitter.on(events['participant-joined'], onParticipantJoined); | ||
@@ -245,2 +253,3 @@ eventEmitter.on(events['participant-left'], onParticipantLeft); | ||
return function () { | ||
eventEmitter.off(events['meeting-state-changed'], onMeetingStateChanged); | ||
eventEmitter.off(events['participant-joined'], onParticipantJoined); | ||
@@ -278,3 +287,3 @@ eventEmitter.off(events['participant-left'], onParticipantLeft); | ||
var version = "0.1.41"; | ||
var version = "0.1.43"; | ||
@@ -553,2 +562,3 @@ var MeetingProvider = function MeetingProvider(_ref) { | ||
if (typeof (meeting === null || meeting === void 0 ? void 0 : meeting.off) === 'function') { | ||
meeting.off('meeting-state-changed', _handle_meeting_state_changed); | ||
meeting.off('participant-joined', _handle_participant_joined); | ||
@@ -649,2 +659,6 @@ meeting.off('participant-left', _handle_participant_left); | ||
var _handle_meeting_state_changed = function _handle_meeting_state_changed(data) { | ||
eventEmitter.emit(events['meeting-state-changed'], data); | ||
}; | ||
var join = function join() { | ||
@@ -658,2 +672,3 @@ var meeting = VideoSDK && VideoSDK.initMeeting(configRef.current); | ||
setLocalParticipant(localParticipant); | ||
meeting.on('meeting-state-changed', _handle_meeting_state_changed); | ||
meeting.on('participant-joined', _handle_participant_joined); | ||
@@ -1078,3 +1093,5 @@ meeting.on('participant-left', _handle_participant_left); | ||
_ref$onStreamDisabled = _ref.onStreamDisabled, | ||
onStreamDisabled = _ref$onStreamDisabled === void 0 ? function () {} : _ref$onStreamDisabled; | ||
onStreamDisabled = _ref$onStreamDisabled === void 0 ? function () {} : _ref$onStreamDisabled, | ||
_ref$onMediaStatusCha = _ref.onMediaStatusChanged, | ||
onMediaStatusChanged = _ref$onMediaStatusCha === void 0 ? function () {} : _ref$onMediaStatusCha; | ||
@@ -1122,2 +1139,10 @@ var _useState = useState(null), | ||
var _useState4 = useState(participant === null || participant === void 0 ? void 0 : participant.webcamOn), | ||
webcamOn = _useState4[0], | ||
setWebcamOn = _useState4[1]; | ||
var _useState5 = useState(participant === null || participant === void 0 ? void 0 : participant.micOn), | ||
micOn = _useState5[0], | ||
setMicOn = _useState5[1]; | ||
var setTrack = function setTrack(stream) { | ||
@@ -1169,2 +1194,20 @@ if (stream.track.readyState === 'live') { | ||
var _handleMediaStatusChanged = function _handleMediaStatusChanged(data) { | ||
var kind = data.kind, | ||
peerId = data.peerId, | ||
newStatus = data.newStatus; | ||
if (kind == 'audio') { | ||
setMicOn(newStatus); | ||
} else if (kind == 'video') { | ||
setWebcamOn(newStatus); | ||
} | ||
onMediaStatusChanged({ | ||
kind: kind, | ||
peerId: peerId, | ||
newStatus: newStatus | ||
}); | ||
}; | ||
var setQuality = function setQuality(quality) { | ||
@@ -1202,2 +1245,10 @@ participant === null || participant === void 0 ? void 0 : participant.setQuality(quality); | ||
var getAudioStats = function getAudioStats() { | ||
return Promise.resolve(participant === null || participant === void 0 ? void 0 : participant.getAudioStats()); | ||
}; | ||
var getVideoStats = function getVideoStats() { | ||
return Promise.resolve(participant === null || participant === void 0 ? void 0 : participant.getVideoStats()); | ||
}; | ||
var consumeWebcamStreams = function consumeWebcamStreams() { | ||
@@ -1232,7 +1283,17 @@ participant === null || participant === void 0 ? void 0 : participant.consumeWebcamStreams(); | ||
if (participant !== null && participant !== void 0 && participant.micOn) { | ||
setMicOn(micOn); | ||
} | ||
if (participant !== null && participant !== void 0 && participant.webcamOn) { | ||
setWebcamOn(webcamOn); | ||
} | ||
participant === null || participant === void 0 ? void 0 : participant.on('stream-enabled', _handleStreamEnabled); | ||
participant === null || participant === void 0 ? void 0 : participant.on('stream-disabled', _handleStreamDisabled); | ||
participant === null || participant === void 0 ? void 0 : participant.on('media-status-changed', _handleMediaStatusChanged); | ||
return function () { | ||
participant === null || participant === void 0 ? void 0 : participant.off('stream-enabled', _handleStreamEnabled); | ||
participant === null || participant === void 0 ? void 0 : participant.off('stream-disabled', _handleStreamDisabled); | ||
participant === null || participant === void 0 ? void 0 : participant.off('media-status-changed', _handleMediaStatusChanged); | ||
}; | ||
@@ -1246,4 +1307,4 @@ }, [participant]); | ||
screenShareStream: screenShareStream, | ||
webcamOn: !!webcamStream, | ||
micOn: !!micStream, | ||
webcamOn: webcamOn, | ||
micOn: micOn, | ||
screenShareOn: !!screenShareStream, | ||
@@ -1266,3 +1327,5 @@ isLocal: (localParticipant === null || localParticipant === void 0 ? void 0 : localParticipant.id) === participantId, | ||
unpin: unpin, | ||
switchTo: switchTo | ||
switchTo: switchTo, | ||
getAudioStats: getAudioStats, | ||
getVideoStats: getVideoStats | ||
}; | ||
@@ -1269,0 +1332,0 @@ }; |
{ | ||
"name": "@videosdk.live/react-sdk", | ||
"version": "0.1.42", | ||
"version": "0.1.43", | ||
"license": "ISC", | ||
@@ -72,5 +72,5 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@videosdk.live/js-sdk": "0.0.41", | ||
"@videosdk.live/js-sdk": "0.0.42", | ||
"events": "^3.3.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
316487
2657
+ Added@videosdk.live/js-sdk@0.0.42(transitive)
- Removed@videosdk.live/js-sdk@0.0.41(transitive)
Updated@videosdk.live/js-sdk@0.0.42