Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(screenshare) Add timestamp to desktop track

robertpin92c6324ff324
diff --git a/conference.js b/conference.js
index 3c5443d821..c8cd0f9e87 100644
--- a/conference.js
+++ b/conference.js
@@ -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 => {
diff --git a/react/features/analytics/AnalyticsEvents.js b/react/features/analytics/AnalyticsEvents.js
index bffac73e41..6d7056078a 100644
--- a/react/features/analytics/AnalyticsEvents.js
+++ b/react/features/analytics/AnalyticsEvents.js
@@ -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
+ }
};
}
diff --git a/react/features/base/tracks/middleware.js b/react/features/base/tracks/middleware.js
index 65b0fee210..bab90bbc2e 100644
--- a/react/features/base/tracks/middleware.js
+++ b/react/features/base/tracks/middleware.js
@@ -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());
}