@microsoft/live-share-react 1.4.0-preview.0 → 1.4.1-preview.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cjs/index.d.ts +7 -0
- package/bin/cjs/index.d.ts.map +1 -0
- package/bin/cjs/index.js +23 -0
- package/bin/cjs/index.js.map +1 -0
- package/bin/cjs/interfaces/LiveInterfaceExtensions.d.ts +26 -0
- package/bin/cjs/interfaces/LiveInterfaceExtensions.d.ts.map +1 -0
- package/bin/cjs/interfaces/LiveInterfaceExtensions.js +7 -0
- package/bin/cjs/interfaces/LiveInterfaceExtensions.js.map +1 -0
- package/bin/cjs/interfaces/index.d.ts +2 -0
- package/bin/cjs/interfaces/index.d.ts.map +1 -0
- package/bin/cjs/interfaces/index.js +18 -0
- package/bin/cjs/interfaces/index.js.map +1 -0
- package/bin/cjs/internal/errors.d.ts +41 -0
- package/bin/cjs/internal/errors.d.ts.map +1 -0
- package/bin/cjs/internal/errors.js +48 -0
- package/bin/cjs/internal/errors.js.map +1 -0
- package/bin/cjs/internal/index.d.ts +3 -0
- package/bin/cjs/internal/index.d.ts.map +1 -0
- package/bin/cjs/internal/index.js +19 -0
- package/bin/cjs/internal/index.js.map +1 -0
- package/bin/cjs/internal/type-guards.d.ts +11 -0
- package/bin/cjs/internal/type-guards.d.ts.map +1 -0
- package/bin/cjs/internal/type-guards.js +24 -0
- package/bin/cjs/internal/type-guards.js.map +1 -0
- package/bin/cjs/live-hooks/index.d.ts +8 -0
- package/bin/cjs/live-hooks/index.d.ts.map +1 -0
- package/bin/cjs/live-hooks/index.js +24 -0
- package/bin/cjs/live-hooks/index.js.map +1 -0
- package/bin/cjs/live-hooks/useLiveCanvas.d.ts +80 -0
- package/bin/cjs/live-hooks/useLiveCanvas.d.ts.map +1 -0
- package/bin/cjs/live-hooks/useLiveCanvas.js +244 -0
- package/bin/cjs/live-hooks/useLiveCanvas.js.map +1 -0
- package/bin/cjs/live-hooks/useLiveEvent.d.ts +59 -0
- package/bin/cjs/live-hooks/useLiveEvent.d.ts.map +1 -0
- package/bin/cjs/live-hooks/useLiveEvent.js +150 -0
- package/bin/cjs/live-hooks/useLiveEvent.js.map +1 -0
- package/bin/cjs/live-hooks/useLiveFollowMode.d.ts +163 -0
- package/bin/cjs/live-hooks/useLiveFollowMode.d.ts.map +1 -0
- package/bin/cjs/live-hooks/useLiveFollowMode.js +360 -0
- package/bin/cjs/live-hooks/useLiveFollowMode.js.map +1 -0
- package/bin/cjs/live-hooks/useLivePresence.d.ts +76 -0
- package/bin/cjs/live-hooks/useLivePresence.d.ts.map +1 -0
- package/bin/cjs/live-hooks/useLivePresence.js +170 -0
- package/bin/cjs/live-hooks/useLivePresence.js.map +1 -0
- package/bin/cjs/live-hooks/useLiveState.d.ts +66 -0
- package/bin/cjs/live-hooks/useLiveState.d.ts.map +1 -0
- package/bin/cjs/live-hooks/useLiveState.js +134 -0
- package/bin/cjs/live-hooks/useLiveState.js.map +1 -0
- package/bin/cjs/live-hooks/useLiveTimer.d.ts +80 -0
- package/bin/cjs/live-hooks/useLiveTimer.d.ts.map +1 -0
- package/bin/cjs/live-hooks/useLiveTimer.js +233 -0
- package/bin/cjs/live-hooks/useLiveTimer.js.map +1 -0
- package/bin/cjs/live-hooks/useMediaSynchronizer.d.ts +86 -0
- package/bin/cjs/live-hooks/useMediaSynchronizer.d.ts.map +1 -0
- package/bin/cjs/live-hooks/useMediaSynchronizer.js +301 -0
- package/bin/cjs/live-hooks/useMediaSynchronizer.js.map +1 -0
- package/bin/cjs/package.json +1 -0
- package/bin/cjs/providers/AzureProvider.d.ts +113 -0
- package/bin/cjs/providers/AzureProvider.d.ts.map +1 -0
- package/bin/cjs/providers/AzureProvider.js +127 -0
- package/bin/cjs/providers/AzureProvider.js.map +1 -0
- package/bin/cjs/providers/LiveShareProvider.d.ts +193 -0
- package/bin/cjs/providers/LiveShareProvider.d.ts.map +1 -0
- package/bin/cjs/providers/LiveShareProvider.js +205 -0
- package/bin/cjs/providers/LiveShareProvider.js.map +1 -0
- package/bin/cjs/providers/index.d.ts +3 -0
- package/bin/cjs/providers/index.d.ts.map +1 -0
- package/bin/cjs/providers/index.js +19 -0
- package/bin/cjs/providers/index.js.map +1 -0
- package/bin/cjs/shared-hooks/index.d.ts +7 -0
- package/bin/cjs/shared-hooks/index.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/index.js +23 -0
- package/bin/cjs/shared-hooks/index.js.map +1 -0
- package/bin/cjs/shared-hooks/internals/tree-node-constants.d.ts +3 -0
- package/bin/cjs/shared-hooks/internals/tree-node-constants.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/internals/tree-node-constants.js +6 -0
- package/bin/cjs/shared-hooks/internals/tree-node-constants.js.map +1 -0
- package/bin/cjs/shared-hooks/internals/tree-node-types.d.ts +10 -0
- package/bin/cjs/shared-hooks/internals/tree-node-types.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/internals/tree-node-types.js +23 -0
- package/bin/cjs/shared-hooks/internals/tree-node-types.js.map +1 -0
- package/bin/cjs/shared-hooks/internals/tree-node-utils.d.ts +33 -0
- package/bin/cjs/shared-hooks/internals/tree-node-utils.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/internals/tree-node-utils.js +193 -0
- package/bin/cjs/shared-hooks/internals/tree-node-utils.js.map +1 -0
- package/bin/cjs/shared-hooks/useDynamicDDS.d.ts +23 -0
- package/bin/cjs/shared-hooks/useDynamicDDS.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/useDynamicDDS.js +87 -0
- package/bin/cjs/shared-hooks/useDynamicDDS.js.map +1 -0
- package/bin/cjs/shared-hooks/useSharedMap.d.ts +25 -0
- package/bin/cjs/shared-hooks/useSharedMap.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/useSharedMap.js +134 -0
- package/bin/cjs/shared-hooks/useSharedMap.js.map +1 -0
- package/bin/cjs/shared-hooks/useSharedState.d.ts +22 -0
- package/bin/cjs/shared-hooks/useSharedState.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/useSharedState.js +80 -0
- package/bin/cjs/shared-hooks/useSharedState.js.map +1 -0
- package/bin/cjs/shared-hooks/useSharedStateRegistry.d.ts +37 -0
- package/bin/cjs/shared-hooks/useSharedStateRegistry.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/useSharedStateRegistry.js +120 -0
- package/bin/cjs/shared-hooks/useSharedStateRegistry.js.map +1 -0
- package/bin/cjs/shared-hooks/useSharedTree.d.ts +57 -0
- package/bin/cjs/shared-hooks/useSharedTree.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/useSharedTree.js +123 -0
- package/bin/cjs/shared-hooks/useSharedTree.js.map +1 -0
- package/bin/cjs/shared-hooks/useTreeNode.d.ts +96 -0
- package/bin/cjs/shared-hooks/useTreeNode.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/useTreeNode.js +135 -0
- package/bin/cjs/shared-hooks/useTreeNode.js.map +1 -0
- package/bin/cjs/types/ActionTypes.d.ts +112 -0
- package/bin/cjs/types/ActionTypes.d.ts.map +1 -0
- package/bin/cjs/types/ActionTypes.js +7 -0
- package/bin/cjs/types/ActionTypes.js.map +1 -0
- package/bin/cjs/types/PropTypes.d.ts +56 -0
- package/bin/cjs/types/PropTypes.d.ts.map +1 -0
- package/bin/cjs/types/PropTypes.js +7 -0
- package/bin/cjs/types/PropTypes.js.map +1 -0
- package/bin/cjs/types/ResultTypes.d.ts +334 -0
- package/bin/cjs/types/ResultTypes.d.ts.map +1 -0
- package/bin/cjs/types/ResultTypes.js +7 -0
- package/bin/cjs/types/ResultTypes.js.map +1 -0
- package/bin/cjs/types/index.d.ts +4 -0
- package/bin/cjs/types/index.d.ts.map +1 -0
- package/bin/cjs/types/index.js +20 -0
- package/bin/cjs/types/index.js.map +1 -0
- package/bin/cjs/utils/index.d.ts +2 -0
- package/bin/cjs/utils/index.d.ts.map +1 -0
- package/bin/cjs/utils/index.js +18 -0
- package/bin/cjs/utils/index.js.map +1 -0
- package/bin/cjs/utils/type-check.d.ts +15 -0
- package/bin/cjs/utils/type-check.d.ts.map +1 -0
- package/bin/cjs/utils/type-check.js +62 -0
- package/bin/cjs/utils/type-check.js.map +1 -0
- package/bin/esm/index.d.ts +7 -0
- package/bin/esm/index.d.ts.map +1 -0
- package/bin/esm/index.js +7 -0
- package/bin/esm/index.js.map +1 -0
- package/bin/esm/interfaces/LiveInterfaceExtensions.d.ts +26 -0
- package/bin/esm/interfaces/LiveInterfaceExtensions.d.ts.map +1 -0
- package/bin/esm/interfaces/LiveInterfaceExtensions.js +6 -0
- package/bin/esm/interfaces/LiveInterfaceExtensions.js.map +1 -0
- package/bin/esm/interfaces/index.d.ts +2 -0
- package/bin/esm/interfaces/index.d.ts.map +1 -0
- package/bin/esm/interfaces/index.js +2 -0
- package/bin/esm/interfaces/index.js.map +1 -0
- package/bin/esm/internal/errors.d.ts +41 -0
- package/bin/esm/internal/errors.d.ts.map +1 -0
- package/bin/esm/internal/errors.js +42 -0
- package/bin/esm/internal/errors.js.map +1 -0
- package/bin/esm/internal/index.d.ts +3 -0
- package/bin/esm/internal/index.d.ts.map +1 -0
- package/bin/esm/internal/index.js +3 -0
- package/bin/esm/internal/index.js.map +1 -0
- package/bin/esm/internal/type-guards.d.ts +11 -0
- package/bin/esm/internal/type-guards.d.ts.map +1 -0
- package/bin/esm/internal/type-guards.js +20 -0
- package/bin/esm/internal/type-guards.js.map +1 -0
- package/bin/esm/live-hooks/index.d.ts +8 -0
- package/bin/esm/live-hooks/index.d.ts.map +1 -0
- package/bin/esm/live-hooks/index.js +8 -0
- package/bin/esm/live-hooks/index.js.map +1 -0
- package/bin/esm/live-hooks/useLiveCanvas.d.ts +80 -0
- package/bin/esm/live-hooks/useLiveCanvas.d.ts.map +1 -0
- package/bin/esm/live-hooks/useLiveCanvas.js +238 -0
- package/bin/esm/live-hooks/useLiveCanvas.js.map +1 -0
- package/bin/esm/live-hooks/useLiveEvent.d.ts +59 -0
- package/bin/esm/live-hooks/useLiveEvent.d.ts.map +1 -0
- package/bin/esm/live-hooks/useLiveEvent.js +144 -0
- package/bin/esm/live-hooks/useLiveEvent.js.map +1 -0
- package/bin/esm/live-hooks/useLiveFollowMode.d.ts +163 -0
- package/bin/esm/live-hooks/useLiveFollowMode.d.ts.map +1 -0
- package/bin/esm/live-hooks/useLiveFollowMode.js +354 -0
- package/bin/esm/live-hooks/useLiveFollowMode.js.map +1 -0
- package/bin/esm/live-hooks/useLivePresence.d.ts +76 -0
- package/bin/esm/live-hooks/useLivePresence.d.ts.map +1 -0
- package/bin/esm/live-hooks/useLivePresence.js +164 -0
- package/bin/esm/live-hooks/useLivePresence.js.map +1 -0
- package/bin/esm/live-hooks/useLiveState.d.ts +66 -0
- package/bin/esm/live-hooks/useLiveState.d.ts.map +1 -0
- package/bin/esm/live-hooks/useLiveState.js +128 -0
- package/bin/esm/live-hooks/useLiveState.js.map +1 -0
- package/bin/esm/live-hooks/useLiveTimer.d.ts +80 -0
- package/bin/esm/live-hooks/useLiveTimer.d.ts.map +1 -0
- package/bin/esm/live-hooks/useLiveTimer.js +227 -0
- package/bin/esm/live-hooks/useLiveTimer.js.map +1 -0
- package/bin/esm/live-hooks/useMediaSynchronizer.d.ts +86 -0
- package/bin/esm/live-hooks/useMediaSynchronizer.d.ts.map +1 -0
- package/bin/esm/live-hooks/useMediaSynchronizer.js +295 -0
- package/bin/esm/live-hooks/useMediaSynchronizer.js.map +1 -0
- package/bin/esm/providers/AzureProvider.d.ts +113 -0
- package/bin/esm/providers/AzureProvider.d.ts.map +1 -0
- package/bin/esm/providers/AzureProvider.js +119 -0
- package/bin/esm/providers/AzureProvider.js.map +1 -0
- package/bin/esm/providers/LiveShareProvider.d.ts +193 -0
- package/bin/esm/providers/LiveShareProvider.d.ts.map +1 -0
- package/bin/esm/providers/LiveShareProvider.js +197 -0
- package/bin/esm/providers/LiveShareProvider.js.map +1 -0
- package/bin/esm/providers/index.d.ts +3 -0
- package/bin/esm/providers/index.d.ts.map +1 -0
- package/bin/esm/providers/index.js +3 -0
- package/bin/esm/providers/index.js.map +1 -0
- package/bin/esm/shared-hooks/index.d.ts +7 -0
- package/bin/esm/shared-hooks/index.d.ts.map +1 -0
- package/bin/esm/shared-hooks/index.js +7 -0
- package/bin/esm/shared-hooks/index.js.map +1 -0
- package/bin/esm/shared-hooks/internals/tree-node-constants.d.ts +3 -0
- package/bin/esm/shared-hooks/internals/tree-node-constants.d.ts.map +1 -0
- package/bin/esm/shared-hooks/internals/tree-node-constants.js +3 -0
- package/bin/esm/shared-hooks/internals/tree-node-constants.js.map +1 -0
- package/bin/esm/shared-hooks/internals/tree-node-types.d.ts +10 -0
- package/bin/esm/shared-hooks/internals/tree-node-types.d.ts.map +1 -0
- package/bin/esm/shared-hooks/internals/tree-node-types.js +18 -0
- package/bin/esm/shared-hooks/internals/tree-node-types.js.map +1 -0
- package/bin/esm/shared-hooks/internals/tree-node-utils.d.ts +33 -0
- package/bin/esm/shared-hooks/internals/tree-node-utils.d.ts.map +1 -0
- package/bin/esm/shared-hooks/internals/tree-node-utils.js +188 -0
- package/bin/esm/shared-hooks/internals/tree-node-utils.js.map +1 -0
- package/bin/esm/shared-hooks/useDynamicDDS.d.ts +23 -0
- package/bin/esm/shared-hooks/useDynamicDDS.d.ts.map +1 -0
- package/bin/esm/shared-hooks/useDynamicDDS.js +81 -0
- package/bin/esm/shared-hooks/useDynamicDDS.js.map +1 -0
- package/bin/esm/shared-hooks/useSharedMap.d.ts +25 -0
- package/bin/esm/shared-hooks/useSharedMap.d.ts.map +1 -0
- package/bin/esm/shared-hooks/useSharedMap.js +128 -0
- package/bin/esm/shared-hooks/useSharedMap.js.map +1 -0
- package/bin/esm/shared-hooks/useSharedState.d.ts +22 -0
- package/bin/esm/shared-hooks/useSharedState.d.ts.map +1 -0
- package/bin/esm/shared-hooks/useSharedState.js +74 -0
- package/bin/esm/shared-hooks/useSharedState.js.map +1 -0
- package/bin/esm/shared-hooks/useSharedStateRegistry.d.ts +37 -0
- package/bin/esm/shared-hooks/useSharedStateRegistry.d.ts.map +1 -0
- package/bin/esm/shared-hooks/useSharedStateRegistry.js +113 -0
- package/bin/esm/shared-hooks/useSharedStateRegistry.js.map +1 -0
- package/bin/esm/shared-hooks/useSharedTree.d.ts +57 -0
- package/bin/esm/shared-hooks/useSharedTree.d.ts.map +1 -0
- package/bin/esm/shared-hooks/useSharedTree.js +117 -0
- package/bin/esm/shared-hooks/useSharedTree.js.map +1 -0
- package/bin/esm/shared-hooks/useTreeNode.d.ts +96 -0
- package/bin/esm/shared-hooks/useTreeNode.d.ts.map +1 -0
- package/bin/esm/shared-hooks/useTreeNode.js +132 -0
- package/bin/esm/shared-hooks/useTreeNode.js.map +1 -0
- package/bin/esm/types/ActionTypes.d.ts +112 -0
- package/bin/esm/types/ActionTypes.d.ts.map +1 -0
- package/bin/esm/types/ActionTypes.js +6 -0
- package/bin/esm/types/ActionTypes.js.map +1 -0
- package/bin/esm/types/PropTypes.d.ts +56 -0
- package/bin/esm/types/PropTypes.d.ts.map +1 -0
- package/bin/esm/types/PropTypes.js +6 -0
- package/bin/esm/types/PropTypes.js.map +1 -0
- package/bin/esm/types/ResultTypes.d.ts +334 -0
- package/bin/esm/types/ResultTypes.d.ts.map +1 -0
- package/bin/esm/types/ResultTypes.js +6 -0
- package/bin/esm/types/ResultTypes.js.map +1 -0
- package/bin/esm/types/index.d.ts +4 -0
- package/bin/esm/types/index.d.ts.map +1 -0
- package/bin/esm/types/index.js +4 -0
- package/bin/esm/types/index.js.map +1 -0
- package/bin/esm/utils/index.d.ts +2 -0
- package/bin/esm/utils/index.d.ts.map +1 -0
- package/bin/esm/utils/index.js +2 -0
- package/bin/esm/utils/index.js.map +1 -0
- package/bin/esm/utils/type-check.d.ts +15 -0
- package/bin/esm/utils/type-check.d.ts.map +1 -0
- package/bin/esm/utils/type-check.js +54 -0
- package/bin/esm/utils/type-check.js.map +1 -0
- package/bin/internal/errors.d.ts +15 -0
- package/bin/internal/errors.d.ts.map +1 -1
- package/bin/internal/errors.js.map +1 -1
- package/bin/internal/type-guards.d.ts +5 -0
- package/bin/internal/type-guards.d.ts.map +1 -1
- package/bin/internal/type-guards.js +12 -0
- package/bin/internal/type-guards.js.map +1 -1
- package/bin/live-hooks/useLiveState.d.ts.map +1 -1
- package/bin/live-hooks/useLiveState.js +6 -2
- package/bin/live-hooks/useLiveState.js.map +1 -1
- package/bin/providers/LiveShareProvider.d.ts.map +1 -1
- package/bin/providers/LiveShareProvider.js +8 -0
- package/bin/providers/LiveShareProvider.js.map +1 -1
- package/package.json +8 -8
- package/src/internal/errors.ts +16 -0
- package/src/internal/type-guards.ts +12 -0
- package/src/live-hooks/useLiveState.ts +5 -2
- package/src/providers/LiveShareProvider.tsx +12 -0
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the Microsoft Live Share SDK License.
|
|
4
|
+
*/
|
|
5
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
import { LiveDataObjectInitializeState, } from "@microsoft/live-share";
|
|
15
|
+
import React from "react";
|
|
16
|
+
import { LiveMediaSession, } from "@microsoft/live-share-media";
|
|
17
|
+
import { isExtendedMediaMetadata, isMediaElement, isRefObject, } from "../utils/index.js";
|
|
18
|
+
import { useDynamicDDS } from "../shared-hooks/index.js";
|
|
19
|
+
import { useFluidObjectsContext } from "../providers/index.js";
|
|
20
|
+
import { ActionContainerNotJoinedError, ActionLiveDataObjectUndefinedError, } from "../internal/index.js";
|
|
21
|
+
/**
|
|
22
|
+
* React hook for using a Live Share media `MediaPlayerSynchronizer`.
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
* Use this hook if you want to synchronize the playback position of a video or audio element during a Live Share session.
|
|
26
|
+
* This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
|
|
27
|
+
*
|
|
28
|
+
* @param uniqueKey uniqueKey value for the `LiveMediaSession` DDS object used by `MediaPlayerSynchronizer`.
|
|
29
|
+
* @param mediaPlayerElement React RefObject containing object/element conforming to IMediaPlayer interface, `IMediaPlayer` object, or string id for <video> / <audio> element.
|
|
30
|
+
* @param initialTrack initial track to load. Either ExtendedMediaMetadata, trackId string, or null.
|
|
31
|
+
* @param allowedRoles Optional. Array of user roles that are eligible to modify group playback state.
|
|
32
|
+
* @param viewOnly Optional. Flag for whether or not the media synchronizer should be in viewOnly mode.
|
|
33
|
+
* @param canSendPositionUpdates Optional. Controls whether or not the local client is allowed to send position updates to the group.
|
|
34
|
+
* @returns IUseMediaSynchronizerResults object.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
```jsx
|
|
38
|
+
import { useMediaSynchronizer } from "@microsoft/live-share-react";
|
|
39
|
+
import { UserMeetingRole } from "@microsoft/live-share";
|
|
40
|
+
import { MediaPlayerSynchronizerEvents } from "@microsoft/live-share-media";
|
|
41
|
+
import { useRef, useEffect } from "react";
|
|
42
|
+
|
|
43
|
+
const ALLOWED_ROLES = [UserMeetingRole.organizer, UserMeetingRole.presenter];
|
|
44
|
+
|
|
45
|
+
const INITIAL_TRACK = "<YOUR_VIDEO_URL>";
|
|
46
|
+
|
|
47
|
+
// Define a unique key that distinguishes this `useMediaSynchronizer` from others in your app
|
|
48
|
+
const UNIQUE_KEY = "MEDIA-SESSION-ID";
|
|
49
|
+
|
|
50
|
+
export function VideoPlayer() {
|
|
51
|
+
const videoRef = useRef(null);
|
|
52
|
+
const { play, pause, seekTo, mediaSynchronizer } = useMediaSynchronizer(
|
|
53
|
+
UNIQUE_KEY,
|
|
54
|
+
videoRef,
|
|
55
|
+
INITIAL_TRACK,
|
|
56
|
+
ALLOWED_ROLES
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
// Listen for groupaction events (optional)
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
// Listen for player group actions for errors (e.g., play error)
|
|
62
|
+
const onGroupAction = (evt: IMediaPlayerSynchronizerEvent) => {
|
|
63
|
+
// See which user made the change (e.g., to display a notification)
|
|
64
|
+
const clientInfo = await synchronizer.mediaSession.getClientInfo(evt.details.clientId);
|
|
65
|
+
};
|
|
66
|
+
mediaSynchronizer?.addEventListener(
|
|
67
|
+
MediaPlayerSynchronizerEvents.groupaction,
|
|
68
|
+
onGroupAction
|
|
69
|
+
);
|
|
70
|
+
return () => {
|
|
71
|
+
mediaSynchronizer?.removeEventListener(
|
|
72
|
+
MediaPlayerSynchronizerEvents.groupaction,
|
|
73
|
+
onGroupAction
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
}, [mediaSynchronizer]);
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<div>
|
|
80
|
+
<video ref={videoRef} />
|
|
81
|
+
<button onClick={play}>
|
|
82
|
+
Play
|
|
83
|
+
</button>
|
|
84
|
+
<button onClick={pause}>
|
|
85
|
+
Pause
|
|
86
|
+
</button>
|
|
87
|
+
<button onClick={() => {
|
|
88
|
+
seekTo(0);
|
|
89
|
+
}}>
|
|
90
|
+
Start over
|
|
91
|
+
</button>
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
*/
|
|
97
|
+
export function useMediaSynchronizer(uniqueKey, mediaPlayerElement, initialTrack, allowedRoles, viewOnly, canSendPositionUpdates) {
|
|
98
|
+
/**
|
|
99
|
+
* User facing media synchronizer and non-user facing setter
|
|
100
|
+
*/
|
|
101
|
+
const [mediaSynchronizer, setMediaSynchronizer] = React.useState();
|
|
102
|
+
/**
|
|
103
|
+
* Suspension object and setter
|
|
104
|
+
*/
|
|
105
|
+
const [suspension, setSuspension] = React.useState();
|
|
106
|
+
/**
|
|
107
|
+
* User facing: dynamically load the LiveMediaSession DDS for the given unique key.
|
|
108
|
+
*/
|
|
109
|
+
const { dds: mediaSession } = useDynamicDDS(uniqueKey, LiveMediaSession);
|
|
110
|
+
const { container } = useFluidObjectsContext();
|
|
111
|
+
/**
|
|
112
|
+
* Play callback
|
|
113
|
+
*/
|
|
114
|
+
const play = React.useCallback(() => __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
if (!container) {
|
|
116
|
+
throw new ActionContainerNotJoinedError("mediaSynchronizer", "play");
|
|
117
|
+
}
|
|
118
|
+
if (mediaSynchronizer === undefined) {
|
|
119
|
+
throw new ActionLiveDataObjectUndefinedError("mediaSynchronizer", "play");
|
|
120
|
+
}
|
|
121
|
+
return yield mediaSynchronizer.play();
|
|
122
|
+
}), [container, mediaSynchronizer]);
|
|
123
|
+
/**
|
|
124
|
+
* Pause callback
|
|
125
|
+
*/
|
|
126
|
+
const pause = React.useCallback(() => __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
if (!container) {
|
|
128
|
+
throw new ActionContainerNotJoinedError("mediaSynchronizer", "pause");
|
|
129
|
+
}
|
|
130
|
+
if (mediaSynchronizer === undefined) {
|
|
131
|
+
throw new ActionLiveDataObjectUndefinedError("mediaSynchronizer", "pause");
|
|
132
|
+
}
|
|
133
|
+
return yield mediaSynchronizer.pause();
|
|
134
|
+
}), [container, mediaSynchronizer]);
|
|
135
|
+
/**
|
|
136
|
+
* User facing: seek callback
|
|
137
|
+
*/
|
|
138
|
+
const seekTo = React.useCallback((time) => __awaiter(this, void 0, void 0, function* () {
|
|
139
|
+
if (!container) {
|
|
140
|
+
throw new ActionContainerNotJoinedError("mediaSynchronizer", "seekTo");
|
|
141
|
+
}
|
|
142
|
+
if (mediaSynchronizer === undefined) {
|
|
143
|
+
throw new ActionLiveDataObjectUndefinedError("mediaSynchronizer", "seekTo");
|
|
144
|
+
}
|
|
145
|
+
return yield mediaSynchronizer.seekTo(time);
|
|
146
|
+
}), [container, mediaSynchronizer]);
|
|
147
|
+
/**
|
|
148
|
+
* User facing: set track callback
|
|
149
|
+
*/
|
|
150
|
+
const setTrack = React.useCallback((track) => __awaiter(this, void 0, void 0, function* () {
|
|
151
|
+
if (!container) {
|
|
152
|
+
throw new ActionContainerNotJoinedError("mediaSynchronizer", "setTrack");
|
|
153
|
+
}
|
|
154
|
+
if (mediaSynchronizer === undefined) {
|
|
155
|
+
throw new ActionLiveDataObjectUndefinedError("mediaSynchronizer", "setTrack");
|
|
156
|
+
}
|
|
157
|
+
if (isExtendedMediaMetadata(track)) {
|
|
158
|
+
return yield mediaSynchronizer.setTrack(track);
|
|
159
|
+
}
|
|
160
|
+
else if (typeof track === "string") {
|
|
161
|
+
return yield mediaSynchronizer.setTrack({
|
|
162
|
+
trackIdentifier: track,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}), [container, mediaSynchronizer]);
|
|
166
|
+
/**
|
|
167
|
+
* User facing: create a new suspension and set it locally to state
|
|
168
|
+
*/
|
|
169
|
+
const beginSuspension = React.useCallback((waitPoint) => {
|
|
170
|
+
const suspension = mediaSession === null || mediaSession === void 0 ? void 0 : mediaSession.coordinator.beginSuspension(waitPoint);
|
|
171
|
+
setSuspension(suspension);
|
|
172
|
+
}, [mediaSession]);
|
|
173
|
+
/**
|
|
174
|
+
* User facing: if a suspension is active, end it. Called when "Follow presenter" button is clicked.
|
|
175
|
+
*/
|
|
176
|
+
const endSuspension = React.useCallback(() => {
|
|
177
|
+
suspension === null || suspension === void 0 ? void 0 : suspension.end();
|
|
178
|
+
setSuspension(undefined);
|
|
179
|
+
}, [suspension]);
|
|
180
|
+
/**
|
|
181
|
+
* Setup change listeners and start `LiveMediaSession` if needed
|
|
182
|
+
*/
|
|
183
|
+
React.useEffect(() => {
|
|
184
|
+
if (mediaSession === undefined || !mediaPlayerElement)
|
|
185
|
+
return;
|
|
186
|
+
let mounted = true;
|
|
187
|
+
// Query the HTML5 media element from the document and set reference
|
|
188
|
+
let mediaPlayer;
|
|
189
|
+
if (isRefObject(mediaPlayerElement)) {
|
|
190
|
+
if (!mediaPlayerElement.current)
|
|
191
|
+
return;
|
|
192
|
+
mediaPlayer = mediaPlayerElement.current;
|
|
193
|
+
}
|
|
194
|
+
else if (typeof mediaPlayerElement === "string") {
|
|
195
|
+
const mediaElement = document.getElementById(mediaPlayerElement);
|
|
196
|
+
if (!isMediaElement(mediaElement))
|
|
197
|
+
return;
|
|
198
|
+
mediaPlayer = mediaElement;
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
mediaPlayer = mediaPlayerElement;
|
|
202
|
+
}
|
|
203
|
+
if (initialTrack) {
|
|
204
|
+
// If supported type and not null, set the initial src
|
|
205
|
+
if (isExtendedMediaMetadata(initialTrack)) {
|
|
206
|
+
mediaPlayer.src = initialTrack.trackIdentifier;
|
|
207
|
+
}
|
|
208
|
+
else if (typeof initialTrack === "string") {
|
|
209
|
+
mediaPlayer.src = initialTrack;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
// Begin synchronizing a MediaSynchronizer for the player
|
|
213
|
+
const synchronizer = mediaSession.synchronize(mediaPlayer);
|
|
214
|
+
if (viewOnly !== undefined) {
|
|
215
|
+
// Set synchronizer to view only mode provided by developer
|
|
216
|
+
synchronizer.viewOnly = viewOnly;
|
|
217
|
+
}
|
|
218
|
+
if (canSendPositionUpdates !== undefined) {
|
|
219
|
+
synchronizer.mediaSession.coordinator.canSendPositionUpdates =
|
|
220
|
+
canSendPositionUpdates;
|
|
221
|
+
}
|
|
222
|
+
if (mediaSession.initializeState ===
|
|
223
|
+
LiveDataObjectInitializeState.needed) {
|
|
224
|
+
// Start synchronizing the media session
|
|
225
|
+
mediaSession.initialize(allowedRoles !== null && allowedRoles !== void 0 ? allowedRoles : []);
|
|
226
|
+
}
|
|
227
|
+
else if (initialTrack) {
|
|
228
|
+
mediaSession.onLocalUserAllowed(() => __awaiter(this, void 0, void 0, function* () {
|
|
229
|
+
if (!mounted)
|
|
230
|
+
return;
|
|
231
|
+
try {
|
|
232
|
+
if (isExtendedMediaMetadata(initialTrack)) {
|
|
233
|
+
yield synchronizer.setTrack(initialTrack);
|
|
234
|
+
}
|
|
235
|
+
else if (typeof initialTrack === "string") {
|
|
236
|
+
yield synchronizer.setTrack({
|
|
237
|
+
trackIdentifier: initialTrack,
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
catch (err) {
|
|
242
|
+
console.error(err);
|
|
243
|
+
}
|
|
244
|
+
}));
|
|
245
|
+
}
|
|
246
|
+
setMediaSynchronizer(synchronizer);
|
|
247
|
+
return () => {
|
|
248
|
+
mounted = false;
|
|
249
|
+
synchronizer.removeAllListeners();
|
|
250
|
+
mediaSession.removeAllListeners();
|
|
251
|
+
synchronizer === null || synchronizer === void 0 ? void 0 : synchronizer.end();
|
|
252
|
+
mediaSession === null || mediaSession === void 0 ? void 0 : mediaSession.dispose();
|
|
253
|
+
};
|
|
254
|
+
}, [mediaSession, mediaPlayerElement]);
|
|
255
|
+
/**
|
|
256
|
+
* Change view in media synchronizer only if prop changes
|
|
257
|
+
*/
|
|
258
|
+
React.useEffect(() => {
|
|
259
|
+
if (!mediaSynchronizer)
|
|
260
|
+
return;
|
|
261
|
+
if (viewOnly === undefined)
|
|
262
|
+
return;
|
|
263
|
+
if (mediaSynchronizer.viewOnly === viewOnly)
|
|
264
|
+
return;
|
|
265
|
+
mediaSynchronizer.viewOnly = viewOnly;
|
|
266
|
+
}, [viewOnly, mediaSynchronizer === null || mediaSynchronizer === void 0 ? void 0 : mediaSynchronizer.viewOnly]);
|
|
267
|
+
/**
|
|
268
|
+
* Change canSendPositionUpdates when prop changes
|
|
269
|
+
*/
|
|
270
|
+
React.useEffect(() => {
|
|
271
|
+
if (!mediaSynchronizer)
|
|
272
|
+
return;
|
|
273
|
+
if (canSendPositionUpdates === undefined)
|
|
274
|
+
return;
|
|
275
|
+
if (mediaSynchronizer.mediaSession.coordinator
|
|
276
|
+
.canSendPositionUpdates === canSendPositionUpdates)
|
|
277
|
+
return;
|
|
278
|
+
mediaSynchronizer.mediaSession.coordinator.canSendPositionUpdates =
|
|
279
|
+
canSendPositionUpdates;
|
|
280
|
+
}, [
|
|
281
|
+
canSendPositionUpdates,
|
|
282
|
+
mediaSynchronizer === null || mediaSynchronizer === void 0 ? void 0 : mediaSynchronizer.mediaSession.coordinator.canSendPositionUpdates,
|
|
283
|
+
]);
|
|
284
|
+
return {
|
|
285
|
+
suspended: !!suspension,
|
|
286
|
+
mediaSynchronizer,
|
|
287
|
+
play,
|
|
288
|
+
pause,
|
|
289
|
+
seekTo,
|
|
290
|
+
setTrack,
|
|
291
|
+
beginSuspension,
|
|
292
|
+
endSuspension,
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
//# sourceMappingURL=useMediaSynchronizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMediaSynchronizer.js","sourceRoot":"","sources":["../../../src/live-hooks/useMediaSynchronizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;AAEH,OAAO,EACH,6BAA6B,GAEhC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIH,gBAAgB,GAGnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACH,uBAAuB,EACvB,cAAc,EACd,WAAW,GACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EACH,6BAA6B,EAC7B,kCAAkC,GACrC,MAAM,sBAAsB,CAAC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AC,UAAU;QACvB,iBAAiB;QACjB,IAAI;QACJ,KAAK;QACL,MAAM;QACN,QAAQ;QACR,eAAe;QACf,aAAa;KAChB,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the Microsoft Live Share SDK License.
|
|
4
|
+
*/
|
|
5
|
+
import { ContainerSchema, IFluidContainer } from "fluid-framework";
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { AzureClientProps, AzureContainerServices } from "@fluidframework/azure-client";
|
|
8
|
+
import { IAzureContainerResults } from "../types/index.js";
|
|
9
|
+
import { ISharedStateRegistryResponse } from "../shared-hooks/index.js";
|
|
10
|
+
import { BaseLiveShareClient } from "@microsoft/live-share/internal";
|
|
11
|
+
/**
|
|
12
|
+
* React Context provider values for `<AzureProvider>` and `<LiveShareProvider>`.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* To get the latest values, use the {@link useFluidObjectsContext} hook.
|
|
16
|
+
*/
|
|
17
|
+
export interface IFluidContext extends ISharedStateRegistryResponse {
|
|
18
|
+
/**
|
|
19
|
+
* The Fluid Turbo client used for connecting to the Fluid container.
|
|
20
|
+
*/
|
|
21
|
+
clientRef: React.MutableRefObject<BaseLiveShareClient>;
|
|
22
|
+
/**
|
|
23
|
+
* Stateful Fluid container.
|
|
24
|
+
*/
|
|
25
|
+
container: IFluidContainer | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The Azure container services (e.g., audience).
|
|
28
|
+
*/
|
|
29
|
+
services: AzureContainerServices | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* A stateful error object that is set if there was an error connecting to the Fluid container.
|
|
32
|
+
*/
|
|
33
|
+
joinError: Error | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* React callback function to connect to an existing Fluid container.
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* The results will also be set to their stateful counterparts for `container` and `services`.
|
|
39
|
+
*
|
|
40
|
+
* @param containerId the containerId to connect to.
|
|
41
|
+
* @param initialObjects Optional. initial object schema, which should match that passed to `createContainer()`.
|
|
42
|
+
* @returns promise that returns a results object once complete (e.g., container, services, etc.)
|
|
43
|
+
*/
|
|
44
|
+
getContainer: (containerId: string, fluidContainerSchema?: ContainerSchema) => Promise<IAzureContainerResults>;
|
|
45
|
+
/**
|
|
46
|
+
* React callback function to create and connect to a new Fluid container.
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* The results will also be set to their stateful counterparts for `container` and `services`.
|
|
50
|
+
*
|
|
51
|
+
* @param initialObjects Optional. The initial object schema to apply to the container.
|
|
52
|
+
* @param onInitializeContainer Optional. A callback for when the container is first initialized, which is useful for setting default values to objects in `initialObjects`.
|
|
53
|
+
* @returns promise that returns a results object once complete (e.g., container, services, etc.)
|
|
54
|
+
*/
|
|
55
|
+
createContainer: (fluidContainerSchema?: ContainerSchema, onInitializeContainer?: (container: IFluidContainer) => void) => Promise<IAzureContainerResults>;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @hidden
|
|
59
|
+
*/
|
|
60
|
+
export declare const FluidContext: React.Context<IFluidContext>;
|
|
61
|
+
/**
|
|
62
|
+
* Hook to get the latest React context state for `FluidContext`.
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
|
|
66
|
+
*
|
|
67
|
+
* @returns current state of `LiveShareContext`
|
|
68
|
+
*/
|
|
69
|
+
export declare const useFluidObjectsContext: () => IFluidContext;
|
|
70
|
+
/**
|
|
71
|
+
* Prop types for {@link AzureProvider} component.
|
|
72
|
+
*/
|
|
73
|
+
export interface IAzureProviderProps {
|
|
74
|
+
/**
|
|
75
|
+
* Optional. React children node for the React Context Provider.
|
|
76
|
+
*/
|
|
77
|
+
children?: React.ReactNode;
|
|
78
|
+
/**
|
|
79
|
+
* Props for initializing a new `AzureClient` instance.
|
|
80
|
+
*/
|
|
81
|
+
clientOptions: AzureClientProps;
|
|
82
|
+
/**
|
|
83
|
+
* The `containerId` to connect to when {@link joinOnLoad} is true.
|
|
84
|
+
*
|
|
85
|
+
* @remarks
|
|
86
|
+
* If you pass in an `undefined` value when {@link createOnLoad} is true, a new container will be created.
|
|
87
|
+
*/
|
|
88
|
+
containerId?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Flag to control whether or not a new container should be created on first mount.
|
|
91
|
+
*
|
|
92
|
+
* @remarks
|
|
93
|
+
* If no {@link containerId} is set when the component first mounts, setting this to `true` will automatically create a new container.
|
|
94
|
+
* This prop does not do anything if you are using `<LiveShareProvider>` instead of `<AzureProvider>`.
|
|
95
|
+
*/
|
|
96
|
+
createOnLoad?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* The initial schema to use when {@link joinOnLoad} or {@link createOnLoad} is true.
|
|
99
|
+
*/
|
|
100
|
+
fluidContainerSchema?: ContainerSchema;
|
|
101
|
+
/**
|
|
102
|
+
* Flag to control whether or not to connect to an existing container on first mount.
|
|
103
|
+
*
|
|
104
|
+
* @remarks
|
|
105
|
+
* Setting this to true will connect to the container if {@link containerId} is provided as a prop.
|
|
106
|
+
*/
|
|
107
|
+
joinOnLoad?: boolean;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* React Context provider component for using Fluid data objects & joining/creating a Fluid document `AzureClient`.
|
|
111
|
+
*/
|
|
112
|
+
export declare const AzureProvider: React.FC<IAzureProviderProps>;
|
|
113
|
+
//# sourceMappingURL=AzureProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AzureProvider.d.ts","sourceRoot":"","sources":["../../../src/providers/AzureProvider.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,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AAe,CAAC;IACvC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAoHvD,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import React from "react";
|
|
12
|
+
import { useSharedStateRegistry, } from "../shared-hooks/index.js";
|
|
13
|
+
import { AzureLiveShareClient } from "@microsoft/live-share";
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
*/
|
|
17
|
+
export const FluidContext = React.createContext({});
|
|
18
|
+
/**
|
|
19
|
+
* Hook to get the latest React context state for `FluidContext`.
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
|
|
23
|
+
*
|
|
24
|
+
* @returns current state of `LiveShareContext`
|
|
25
|
+
*/
|
|
26
|
+
export const useFluidObjectsContext = () => {
|
|
27
|
+
const context = React.useContext(FluidContext);
|
|
28
|
+
if (!isFluidObjectsContext(context)) {
|
|
29
|
+
throw new Error("@microsoft/live-share-react: attempting to use `useFluidObjectsContext()` from a component that is not a child of `<LiveShareProvider>` or `<AzureProvider>`.\nTo fix this error, ensure that you are only using Live Share hooks (e.g., `useLiveState`) from a child component of `<LiveShareProvider>` or `<AzureProvider>`.");
|
|
30
|
+
}
|
|
31
|
+
return context;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* React Context provider component for using Fluid data objects & joining/creating a Fluid document `AzureClient`.
|
|
35
|
+
*/
|
|
36
|
+
export const AzureProvider = (props) => {
|
|
37
|
+
var _a;
|
|
38
|
+
const startedRef = React.useRef(false);
|
|
39
|
+
const clientRef = React.useRef(new AzureLiveShareClient(props.clientOptions));
|
|
40
|
+
const [results, setResults] = React.useState();
|
|
41
|
+
const [joinError, setJoinError] = React.useState();
|
|
42
|
+
const stateRegistryCallbacks = useSharedStateRegistry(results);
|
|
43
|
+
/**
|
|
44
|
+
* Get the container for a given containerId using AzureClient
|
|
45
|
+
*/
|
|
46
|
+
const getContainer = React.useCallback((containerId, fluidContainerSchema) => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
+
return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
+
try {
|
|
49
|
+
const results = yield clientRef.current.getContainer(containerId, fluidContainerSchema);
|
|
50
|
+
setResults(results);
|
|
51
|
+
resolve(results);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
if (error instanceof Error) {
|
|
55
|
+
setJoinError(error);
|
|
56
|
+
}
|
|
57
|
+
reject(error);
|
|
58
|
+
}
|
|
59
|
+
}));
|
|
60
|
+
}), [props.containerId, setResults]);
|
|
61
|
+
/**
|
|
62
|
+
* Create container callback to create a new container using AzureClient
|
|
63
|
+
*/
|
|
64
|
+
const createContainer = React.useCallback((fluidContainerSchema, onInitializeContainer) => __awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
+
return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
+
try {
|
|
67
|
+
const results = yield clientRef.current.createContainer(fluidContainerSchema);
|
|
68
|
+
if (onInitializeContainer) {
|
|
69
|
+
onInitializeContainer(results.container);
|
|
70
|
+
}
|
|
71
|
+
const containerId = yield results.container.attach();
|
|
72
|
+
window.location.hash = containerId;
|
|
73
|
+
setResults(results);
|
|
74
|
+
resolve(results);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
if (error instanceof Error) {
|
|
78
|
+
setJoinError(error);
|
|
79
|
+
}
|
|
80
|
+
reject(error);
|
|
81
|
+
}
|
|
82
|
+
}));
|
|
83
|
+
}), [props.containerId, setResults]);
|
|
84
|
+
/**
|
|
85
|
+
* Joins a container if `props.joinOnLoad` is true and `props.containerId` is known. Creates a new container if `props.createOnLoad` is true
|
|
86
|
+
* and `props.containerId` is not known.
|
|
87
|
+
*/
|
|
88
|
+
React.useEffect(() => {
|
|
89
|
+
var _a;
|
|
90
|
+
// This hook should only be called once, so we use a ref to track if it has been called.
|
|
91
|
+
// This is a workaround for the fact that useEffect is called twice on initial render in React V18.
|
|
92
|
+
// We are not doing this here for backwards compatibility. View the README for more information.
|
|
93
|
+
if (((_a = results === null || results === void 0 ? void 0 : results.container) === null || _a === void 0 ? void 0 : _a.connectionState) !== undefined ||
|
|
94
|
+
startedRef.current)
|
|
95
|
+
return;
|
|
96
|
+
startedRef.current = true;
|
|
97
|
+
if (props.containerId && props.joinOnLoad) {
|
|
98
|
+
getContainer(props.containerId, props.fluidContainerSchema);
|
|
99
|
+
}
|
|
100
|
+
else if (!props.containerId && props.createOnLoad) {
|
|
101
|
+
createContainer(props.fluidContainerSchema);
|
|
102
|
+
}
|
|
103
|
+
}, [
|
|
104
|
+
(_a = results === null || results === void 0 ? void 0 : results.container) === null || _a === void 0 ? void 0 : _a.connectionState,
|
|
105
|
+
props.containerId,
|
|
106
|
+
props.createOnLoad,
|
|
107
|
+
props.joinOnLoad,
|
|
108
|
+
props.fluidContainerSchema,
|
|
109
|
+
getContainer,
|
|
110
|
+
createContainer,
|
|
111
|
+
]);
|
|
112
|
+
return (_jsx(FluidContext.Provider, { value: Object.assign({ clientRef, container: results === null || results === void 0 ? void 0 : results.container, services: results === null || results === void 0 ? void 0 : results.services, joinError,
|
|
113
|
+
createContainer,
|
|
114
|
+
getContainer }, stateRegistryCallbacks), children: props.children }));
|
|
115
|
+
};
|
|
116
|
+
function isFluidObjectsContext(value) {
|
|
117
|
+
return !!(value === null || value === void 0 ? void 0 : value.clientRef);
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=AzureProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AzureProvider.js","sourceRoot":"","sources":["../../../src/providers/AzureProvider.tsx"],"names":[],"mappings":";;;;;;;;;;AAMA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAEH,sBAAsB,GACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAwD7D;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC,aAAa,CAC3C,EAAmB,CACtB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAkB,EAAE;IACtD,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IAC/C,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CACX,gUAAgU,CACnU,CAAC;IACN,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AA0CF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAkC,CAAC,KAAK,EAAE,EAAE;;IAClE,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAU,KAAK,CAAC,CAAC;IAChD,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAC1B,IAAI,oBAAoB,CAAC,KAAK,CAAC,aAAa,CAAC,CAChD,CAAC;IACF,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,Q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