"Fossies" - the Fresh Open Source Software Archive

Member "jitsi-meet-7547/react/features/base/tracks/middleware.native.ts" (25 Sep 2023, 1003 Bytes) of package /linux/misc/jitsi-meet-7547.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 import {
    2     MEDIA_TYPE,
    3     VIDEO_TYPE
    4 } from '../media/constants';
    5 import MiddlewareRegistry from '../redux/MiddlewareRegistry';
    6 
    7 import {
    8     TRACK_UPDATED
    9 } from './actionTypes';
   10 import {
   11     toggleScreensharing
   12 } from './actions.native';
   13 
   14 import './middleware.any';
   15 
   16 /**
   17  * Middleware that captures LIB_DID_DISPOSE and LIB_DID_INIT actions and,
   18  * respectively, creates/destroys local media tracks. Also listens to
   19  * media-related actions and performs corresponding operations with tracks.
   20  *
   21  * @param {Store} store - The redux store.
   22  * @returns {Function}
   23  */
   24 MiddlewareRegistry.register(store => next => action => {
   25     switch (action.type) {
   26     case TRACK_UPDATED: {
   27         const { jitsiTrack, local } = action.track;
   28 
   29         if (local && jitsiTrack.isMuted()
   30                 && jitsiTrack.type === MEDIA_TYPE.VIDEO && jitsiTrack.videoType === VIDEO_TYPE.DESKTOP) {
   31             store.dispatch(toggleScreensharing(false));
   32         }
   33         break;
   34     }
   35     }
   36 
   37     return next(action);
   38 });