| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- import 'image-capture';
- import './createImageBitmap';
- import { AnyAction } from 'redux';
-
- import {
- ADD_FACE_EXPRESSION,
- ADD_TO_FACE_EXPRESSIONS_BUFFER,
- CLEAR_FACE_EXPRESSIONS_BUFFER,
- FACE_LANDMARK_DETECTION_STOPPED,
- NEW_FACE_COORDINATES
- } from './actionTypes';
- import { FaceBox } from './types';
-
- /**
- * Adds a new face expression and its duration.
- *
- * @param {string} faceExpression - Face expression to be added.
- * @param {number} duration - Duration in seconds of the face expression.
- * @param {number} timestamp - Duration in seconds of the face expression.
- * @returns {AnyAction}
- */
- export function addFaceExpression(faceExpression: string, duration: number, timestamp: number): AnyAction {
- return {
- type: ADD_FACE_EXPRESSION,
- faceExpression,
- duration,
- timestamp
- };
- }
-
- /**
- * Adds a face expression with its timestamp to the face expression buffer.
- *
- * @param {Object} faceExpression - Object containing face expression string and its timestamp.
- * @returns {AnyAction}
- */
- export function addToFaceExpressionsBuffer(
- faceExpression: {
- emotion: string;
- timestamp: number;
- }
- ): AnyAction {
- return {
- type: ADD_TO_FACE_EXPRESSIONS_BUFFER,
- faceExpression
- };
- }
-
- /**
- * Clears the face expressions array in the state.
- *
- * @returns {Object}
- */
- export function clearFaceExpressionBuffer() {
- return {
- type: CLEAR_FACE_EXPRESSIONS_BUFFER
- };
- }
-
- /**
- * Signals that a new face box was obtained for the local participant.
- *
- * @param {FaceBox} faceBox - The face box of the local participant.
- * @returns {AnyAction}
- */
- export function newFaceBox(faceBox: FaceBox): AnyAction {
- return {
- type: NEW_FACE_COORDINATES,
- faceBox
- };
- }
-
- /**
- * Dispatches the face landmarks detection stopped event in order to be sent to services.
- *
- * @param {number} timestamp - The timestamp when the camera was off.
- * @returns {AnyAction}
- */
- export function faceLandmarkDetectionStopped(timestamp: number): AnyAction {
- return {
- type: FACE_LANDMARK_DETECTION_STOPPED,
- timestamp
- };
- }
|