fix(screenshare) Add timestamp to desktop track
Send screenshare duration to analytics
This commit is contained in:
parent
4b7a6741fa
commit
92c6324ff3
|
@ -107,6 +107,7 @@ import {
|
|||
getLocalJitsiAudioTrack,
|
||||
getLocalJitsiVideoTrack,
|
||||
getLocalTracks,
|
||||
getLocalVideoTrack,
|
||||
isLocalCameraTrackMuted,
|
||||
isLocalTrackMuted,
|
||||
isUserInteractionRequiredForUnmute,
|
||||
|
@ -1549,6 +1550,8 @@ export default {
|
|||
if (config.enableScreenshotCapture) {
|
||||
APP.store.dispatch(toggleScreenshotCaptureSummary(false));
|
||||
}
|
||||
const tracks = APP.store.getState()['features/base/tracks'];
|
||||
const timestamp = getLocalVideoTrack(tracks)?.timestamp ?? 0;
|
||||
|
||||
// It can happen that presenter GUM is in progress while screensharing is being turned off. Here it needs to
|
||||
// wait for that GUM to be resolved in order to prevent leaking the presenter track(this.localPresenterVideo
|
||||
|
@ -1610,7 +1613,8 @@ export default {
|
|||
return promise.then(
|
||||
() => {
|
||||
this.videoSwitchInProgress = false;
|
||||
sendAnalytics(createScreenSharingEvent('stopped'));
|
||||
sendAnalytics(createScreenSharingEvent('stopped',
|
||||
timestamp === 0 ? null : (Date.now() / 1000) - timestamp));
|
||||
logger.info('Screen sharing stopped.');
|
||||
},
|
||||
error => {
|
||||
|
|
|
@ -602,13 +602,17 @@ export function createVideoBlurEvent(action) {
|
|||
* occurred (e.g. It was started or stopped).
|
||||
*
|
||||
* @param {string} action - The action which occurred.
|
||||
* @param {number?} value - The screenshare duration in seconds.
|
||||
* @returns {Object} The event in a format suitable for sending via
|
||||
* sendAnalytics.
|
||||
*/
|
||||
export function createScreenSharingEvent(action) {
|
||||
export function createScreenSharingEvent(action, value = null) {
|
||||
return {
|
||||
action,
|
||||
actionSubject: 'screen.sharing'
|
||||
actionSubject: 'screen.sharing',
|
||||
attributes: {
|
||||
value
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ MiddlewareRegistry.register(store => next => action => {
|
|||
// The devices list needs to be refreshed when no initial video permissions
|
||||
// were granted and a local video track is added by umuting the video.
|
||||
if (action.track.local) {
|
||||
action.track.timestamp = Date.now() / 1000;
|
||||
store.dispatch(getAvailableDevices());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue