Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More โ†’
Socket
Sign inDemoInstall
Socket

@huddle01/react

Package Overview
Dependencies
Maintainers
5
Versions
264
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@huddle01/react - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

app-utils/dist/huddle01-react-app-utils.cjs.d.ts

20

components/dist/huddle01-react-components.cjs.dev.js

@@ -410,3 +410,4 @@ 'use strict';

mic: ((_consumers$peerConsum = consumers[peerConsumers === null || peerConsumers === void 0 ? void 0 : peerConsumers.mic]) === null || _consumers$peerConsum === void 0 ? void 0 : _consumers$peerConsum.track) || null,
cam: ((_consumers$peerConsum2 = consumers[peerConsumers === null || peerConsumers === void 0 ? void 0 : peerConsumers.cam]) === null || _consumers$peerConsum2 === void 0 ? void 0 : _consumers$peerConsum2.track) || null
cam: ((_consumers$peerConsum2 = consumers[peerConsumers === null || peerConsumers === void 0 ? void 0 : peerConsumers.cam]) === null || _consumers$peerConsum2 === void 0 ? void 0 : _consumers$peerConsum2.track) || null,
displayName: rawPeers[peerId].displayName
};

@@ -505,16 +506,17 @@ return {

_context.prev = 1;
_context.next = 4;
videoObj.muted = true;
_context.next = 5;
return videoObj.play();
case 4:
_context.next = 9;
case 5:
_context.next = 10;
break;
case 6:
_context.prev = 6;
case 7:
_context.prev = 7;
_context.t0 = _context["catch"](1);
console.error(_context.t0);
case 9:
case 10:
case "end":
return _context.stop();
}
}, _callee, null, [[1, 6]]);
}, _callee, null, [[1, 7]]);
}));

@@ -526,3 +528,3 @@ videoObj.onerror = function () {

}, []);
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, debug && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, peerId), /*#__PURE__*/React__default["default"].createElement("video", _extends({}, rest, {
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, debug && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, peer === null || peer === void 0 ? void 0 : peer.displayName, ": ", peerId), /*#__PURE__*/React__default["default"].createElement("video", _extends({}, rest, {
ref: videoRef

@@ -529,0 +531,0 @@ }), "Video"));

@@ -410,3 +410,4 @@ 'use strict';

mic: ((_consumers$peerConsum = consumers[peerConsumers === null || peerConsumers === void 0 ? void 0 : peerConsumers.mic]) === null || _consumers$peerConsum === void 0 ? void 0 : _consumers$peerConsum.track) || null,
cam: ((_consumers$peerConsum2 = consumers[peerConsumers === null || peerConsumers === void 0 ? void 0 : peerConsumers.cam]) === null || _consumers$peerConsum2 === void 0 ? void 0 : _consumers$peerConsum2.track) || null
cam: ((_consumers$peerConsum2 = consumers[peerConsumers === null || peerConsumers === void 0 ? void 0 : peerConsumers.cam]) === null || _consumers$peerConsum2 === void 0 ? void 0 : _consumers$peerConsum2.track) || null,
displayName: rawPeers[peerId].displayName
};

@@ -505,16 +506,17 @@ return {

_context.prev = 1;
_context.next = 4;
videoObj.muted = true;
_context.next = 5;
return videoObj.play();
case 4:
_context.next = 9;
case 5:
_context.next = 10;
break;
case 6:
_context.prev = 6;
case 7:
_context.prev = 7;
_context.t0 = _context["catch"](1);
console.error(_context.t0);
case 9:
case 10:
case "end":
return _context.stop();
}
}, _callee, null, [[1, 6]]);
}, _callee, null, [[1, 7]]);
}));

@@ -526,3 +528,3 @@ videoObj.onerror = function () {

}, []);
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, debug && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, peerId), /*#__PURE__*/React__default["default"].createElement("video", _extends({}, rest, {
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, debug && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, peer === null || peer === void 0 ? void 0 : peer.displayName, ": ", peerId), /*#__PURE__*/React__default["default"].createElement("video", _extends({}, rest, {
ref: videoRef

@@ -529,0 +531,0 @@ }), "Video"));

@@ -402,3 +402,4 @@ import React, { useRef, useEffect } from 'react';

mic: ((_consumers$peerConsum = consumers[peerConsumers === null || peerConsumers === void 0 ? void 0 : peerConsumers.mic]) === null || _consumers$peerConsum === void 0 ? void 0 : _consumers$peerConsum.track) || null,
cam: ((_consumers$peerConsum2 = consumers[peerConsumers === null || peerConsumers === void 0 ? void 0 : peerConsumers.cam]) === null || _consumers$peerConsum2 === void 0 ? void 0 : _consumers$peerConsum2.track) || null
cam: ((_consumers$peerConsum2 = consumers[peerConsumers === null || peerConsumers === void 0 ? void 0 : peerConsumers.cam]) === null || _consumers$peerConsum2 === void 0 ? void 0 : _consumers$peerConsum2.track) || null,
displayName: rawPeers[peerId].displayName
};

@@ -497,16 +498,17 @@ return {

_context.prev = 1;
_context.next = 4;
videoObj.muted = true;
_context.next = 5;
return videoObj.play();
case 4:
_context.next = 9;
case 5:
_context.next = 10;
break;
case 6:
_context.prev = 6;
case 7:
_context.prev = 7;
_context.t0 = _context["catch"](1);
console.error(_context.t0);
case 9:
case 10:
case "end":
return _context.stop();
}
}, _callee, null, [[1, 6]]);
}, _callee, null, [[1, 7]]);
}));

@@ -518,3 +520,3 @@ videoObj.onerror = function () {

}, []);
return /*#__PURE__*/React.createElement(React.Fragment, null, debug && /*#__PURE__*/React.createElement(React.Fragment, null, peerId), /*#__PURE__*/React.createElement("video", _extends({}, rest, {
return /*#__PURE__*/React.createElement(React.Fragment, null, debug && /*#__PURE__*/React.createElement(React.Fragment, null, peer === null || peer === void 0 ? void 0 : peer.displayName, ": ", peerId), /*#__PURE__*/React.createElement("video", _extends({}, rest, {
ref: videoRef

@@ -521,0 +523,0 @@ }), "Video"));

import useAudio from './useAudio';
import useHuddle01 from './useHuddle01';
import useLivestream from './useLivestream';
import useLobby from './useLobby';
import useMeetingMachine from './useMeetingMachine';
import usePeers from './usePeers';
import useRecording from './useRecording';
import useRoom from './useRoom';
import useVideo from './useVideo';
export { useHuddle01, useLobby, useRoom, useAudio, useVideo, useMeetingMachine, usePeers, };
export { useHuddle01, useLobby, useRoom, useAudio, useVideo, useMeetingMachine, usePeers, useRecording, useLivestream, };
import { TMediaStream } from '@huddle01/web-core/types';
declare const useAudio: () => {
stream: TMediaStream;
stream: MediaStream;
isLoading: boolean;

@@ -12,3 +12,3 @@ isProducing: boolean;

(stream: TMediaStream): void;
isCallable: boolean;
isCallable: false | TMediaStream;
};

@@ -15,0 +15,0 @@ stopProducingAudio: {

export default function useHuddle01(): {
initialize: (projectId: string) => void;
initialize: {
(projectId: string): void;
isCallable: boolean;
};
isInitialized: boolean;
};

@@ -5,3 +5,3 @@ declare const useLobby: () => {

joinLobby: {
(roomId: string): void;
(roomId: string, accessToken?: string): void;
isCallable: boolean;

@@ -8,0 +8,0 @@ };

@@ -11,2 +11,3 @@ declare const usePeer: (peerId: string) => {

cam: MediaStreamTrack;
displayName: string;
};

@@ -13,0 +14,0 @@ error: null;

declare const useRoom: () => {
roomId: string;
isLoading: boolean;

@@ -3,0 +4,0 @@ isRoomJoined: boolean;

import { TMediaStream } from '@huddle01/web-core/types';
declare const useVideo: () => {
stream: TMediaStream;
stream: MediaStream;
isLoading: boolean;

@@ -12,3 +12,3 @@ isProducing: boolean;

(stream: TMediaStream): void;
isCallable: boolean;
isCallable: false | TMediaStream;
};

@@ -15,0 +15,0 @@ stopProducingVideo: {

import { useHuddle01 } from './hooks';
declare const events: {
readonly 'lobby:joined': "Initialized.JoinedLobby";
readonly 'lobby:joined': "Initialized.JoinedLobby.Emitted.NotEmitted";
readonly 'lobby:cam-on': "Initialized.JoinedLobby.Cam.On";

@@ -9,6 +9,8 @@ readonly 'lobby:cam-off': "Initialized.JoinedLobby.Cam.Off";

readonly 'lobby:failed': "Initialized.JoinLobbyFailed";
readonly 'room:joined': "Initialized.JoinLobbyFailed";
readonly 'room:joined': "Initialized.JoinedRoom.Emitted.NotEmitted";
readonly 'room:failed': "Initialized.JoinLobbyFailed";
readonly 'room:new-peer': "Initialized.JoinedRoom.Peers.Peers";
readonly 'room:peer-left': "Initialized.JoinedRoom.Peers.Peers";
readonly 'room:audio-producing': "Initialized.JoinedRoom.Mic.ProducingMic";
readonly 'room:video-producing': "Initialized.JoinedRoom.Cam.ProducingCam";
readonly 'room:recording-started': "Initialized.JoinedRoom.Recording.Recording";

@@ -15,0 +17,0 @@ readonly 'room:recording-stopped': "Initialized.JoinedRoom.Recording.Stopped";

@@ -6,3 +6,3 @@ 'use strict';

var React = require('react');
var useHuddle01 = require('./useHuddle01-408c6819.cjs.dev.js');
var useHuddle01 = require('./useHuddle01-500b1c2f.cjs.dev.js');
var useMeetingMachine = require('./useMeetingMachine-2f6b0b36.cjs.dev.js');

@@ -14,3 +14,3 @@ require('@huddle01/web-core');

var events = {
'lobby:joined': 'Initialized.JoinedLobby',
'lobby:joined': 'Initialized.JoinedLobby.Emitted.NotEmitted',
'lobby:cam-on': 'Initialized.JoinedLobby.Cam.On',

@@ -21,6 +21,8 @@ 'lobby:cam-off': 'Initialized.JoinedLobby.Cam.Off',

'lobby:failed': 'Initialized.JoinLobbyFailed',
'room:joined': 'Initialized.JoinLobbyFailed',
'room:joined': 'Initialized.JoinedRoom.Emitted.NotEmitted',
'room:failed': 'Initialized.JoinLobbyFailed',
'room:new-peer': 'Initialized.JoinedRoom.Peers.Peers',
'room:peer-left': 'Initialized.JoinedRoom.Peers.Peers',
'room:audio-producing': 'Initialized.JoinedRoom.Mic.ProducingMic',
'room:video-producing': 'Initialized.JoinedRoom.Cam.ProducingCam',
'room:recording-started': 'Initialized.JoinedRoom.Recording.Recording',

@@ -27,0 +29,0 @@ 'room:recording-stopped': 'Initialized.JoinedRoom.Recording.Stopped',

@@ -6,3 +6,3 @@ 'use strict';

var React = require('react');
var useHuddle01 = require('./useHuddle01-2c0cb193.cjs.prod.js');
var useHuddle01 = require('./useHuddle01-1265ff70.cjs.prod.js');
var useMeetingMachine = require('./useMeetingMachine-98789342.cjs.prod.js');

@@ -14,3 +14,3 @@ require('@huddle01/web-core');

var events = {
'lobby:joined': 'Initialized.JoinedLobby',
'lobby:joined': 'Initialized.JoinedLobby.Emitted.NotEmitted',
'lobby:cam-on': 'Initialized.JoinedLobby.Cam.On',

@@ -21,6 +21,8 @@ 'lobby:cam-off': 'Initialized.JoinedLobby.Cam.Off',

'lobby:failed': 'Initialized.JoinLobbyFailed',
'room:joined': 'Initialized.JoinLobbyFailed',
'room:joined': 'Initialized.JoinedRoom.Emitted.NotEmitted',
'room:failed': 'Initialized.JoinLobbyFailed',
'room:new-peer': 'Initialized.JoinedRoom.Peers.Peers',
'room:peer-left': 'Initialized.JoinedRoom.Peers.Peers',
'room:audio-producing': 'Initialized.JoinedRoom.Mic.ProducingMic',
'room:video-producing': 'Initialized.JoinedRoom.Cam.ProducingCam',
'room:recording-started': 'Initialized.JoinedRoom.Recording.Recording',

@@ -27,0 +29,0 @@ 'room:recording-stopped': 'Initialized.JoinedRoom.Recording.Stopped',

import { useEffect } from 'react';
export { u as useHuddle01 } from './useHuddle01-a87593eb.esm.js';
export { u as useHuddle01 } from './useHuddle01-5b7a417e.esm.js';
import { u as useMeetingMachine } from './useMeetingMachine-789f3ee6.esm.js';

@@ -9,3 +9,3 @@ import '@huddle01/web-core';

var events = {
'lobby:joined': 'Initialized.JoinedLobby',
'lobby:joined': 'Initialized.JoinedLobby.Emitted.NotEmitted',
'lobby:cam-on': 'Initialized.JoinedLobby.Cam.On',

@@ -16,6 +16,8 @@ 'lobby:cam-off': 'Initialized.JoinedLobby.Cam.Off',

'lobby:failed': 'Initialized.JoinLobbyFailed',
'room:joined': 'Initialized.JoinLobbyFailed',
'room:joined': 'Initialized.JoinedRoom.Emitted.NotEmitted',
'room:failed': 'Initialized.JoinLobbyFailed',
'room:new-peer': 'Initialized.JoinedRoom.Peers.Peers',
'room:peer-left': 'Initialized.JoinedRoom.Peers.Peers',
'room:audio-producing': 'Initialized.JoinedRoom.Mic.ProducingMic',
'room:video-producing': 'Initialized.JoinedRoom.Cam.ProducingCam',
'room:recording-started': 'Initialized.JoinedRoom.Recording.Recording',

@@ -22,0 +24,0 @@ 'room:recording-stopped': 'Initialized.JoinedRoom.Recording.Stopped',

@@ -7,3 +7,3 @@ 'use strict';

var React = require('react');
var useHuddle01 = require('../../dist/useHuddle01-408c6819.cjs.dev.js');
var useHuddle01 = require('../../dist/useHuddle01-500b1c2f.cjs.dev.js');
require('@huddle01/web-core');

@@ -30,6 +30,6 @@ require('jotai-xstate');

var isFetchAudioStream = state.matches('Initialized.JoinedLobby.Mic.Muted') && !isLoading;
var isProduceAudio = state.matches('Initialized.JoinedRoom.Mic.NotProducing') && !isLoading;
var isProduceAudio = state.matches('Initialized.JoinedRoom.Mic.Unmuted') && !isLoading && state.context.micStream;
var isProducing = state.matches('Initialized.JoinedRoom.Mic.ProducingMic');
var isStopProducingAudio = isProducing && !isLoading;
var isStopAudioStream = state.matches('Initialized.JoinedLobby.Mic.Unmuted') && !isLoading;
var isStopAudioStream = ['Initialized.JoinedRoom.Mic.Unmuted', 'Initialized.JoinedLobby.Mic.Unmuted'].some(state.matches) && !isLoading;

@@ -43,2 +43,3 @@ // methods

var produceAudio = function produceAudio(stream) {
if (!state.context.micStream) return setError('No Mic Stream');
if (!state.matches('Initialized.JoinedRoom')) return setError('You are not in the room');

@@ -79,2 +80,74 @@ if (state.matches('Initialized.JoinedRoom.Mic.ProducingMic')) return setError('Already Producing Audio Stream');

var useLivestream = function useLivestream() {
var _useMeetingMachine = useMeetingMachine.useMeetingMachine(),
state = _useMeetingMachine.state,
send = _useMeetingMachine.send;
var _useState = React.useState(''),
_useState2 = useMeetingMachine._slicedToArray(_useState, 2),
error = _useState2[0],
setError = _useState2[1];
var data = state.context.livestreamData;
// booleans
var isInsideRoom = state.matches('Initialized.JoinedRoom');
var isStarting = ['Initialized.JoinedRoom.Streaming.RecorderJoining', 'Initialized.JoinedRoom.Streaming.Starting'].some(state.matches);
var inProgress = state.matches('Initialized.JoinedRoom.Streaming.Streaming');
var isStopping = ['Initialized.JoinedRoom.Streaming.RecorderLeaving', 'Initialized.JoinedRoom.Streaming.Stopping'].some(state.matches);
// methods
var startLivestream = function startLivestream(sourceUrl, rtmpEndpoint, type) {
if (sourceUrl.includes('localhost')) {
return setError('Livestreaming is not allowed on localhost');
}
if (isStarting) {
return setError('Please wait.. livestream is already starting');
}
if (inProgress) {
return setError('livestream is already in progress');
}
if (isStopping) {
return setError('Please wait.. livestream is about to stop');
}
if (!isInsideRoom) {
return setError('Please join a room first');
}
send({
type: 'START_STREAMING',
streamingData: {
sourceUrl: sourceUrl,
rtmpEndpoint: rtmpEndpoint,
type: type
}
});
};
var stopLivestream = function stopLivestream() {
if (isStarting) {
return setError('Please wait.. livestream is about to start');
}
if (isStopping) {
return setError('Please wait.. livestream is already stopping');
}
if (!inProgress) {
return setError('Livestream is not in progress');
}
if (!isInsideRoom) {
return setError('Please join a room first');
}
send('STOP_STREAMING');
};
// attributes
startLivestream.isCallable = !isStarting && !inProgress && !isStopping && isInsideRoom;
stopLivestream.isCallable = inProgress && isInsideRoom;
return {
isStarting: isStarting,
inProgress: inProgress,
isStopping: isStopping,
data: data,
startLivestream: startLivestream,
stopLivestream: stopLivestream,
error: error
};
};
var useLobby = function useLobby() {

@@ -95,3 +168,3 @@ var _useMeetingMachine = useMeetingMachine.useMeetingMachine(),

// methods
var joinLobby = function joinLobby(roomId) {
var joinLobby = function joinLobby(roomId, accessToken) {
if (!roomId) {

@@ -105,3 +178,4 @@ return setError('No room id provided');

type: 'JOIN_LOBBY',
roomId: roomId
roomId: roomId,
accessToken: accessToken
});

@@ -153,2 +227,75 @@ };

var useRecording = function useRecording() {
var _useMeetingMachine = useMeetingMachine.useMeetingMachine(),
state = _useMeetingMachine.state,
send = _useMeetingMachine.send;
var _useState = React.useState(''),
_useState2 = useMeetingMachine._slicedToArray(_useState, 2),
error = _useState2[0],
setError = _useState2[1];
var data = state.context.recordingData;
// booleans
var isInsideRoom = state.matches('Initialized.JoinedRoom');
var isStarting = ['Initialized.JoinedRoom.Recording.RecorderJoining', 'Initialized.JoinedRoom.Recording.Starting'].some(state.matches);
var inProgress = state.matches('Initialized.JoinedRoom.Recording.Recording');
var isStopping = ['Initialized.JoinedRoom.Recording.RecorderLeaving', 'Initialized.JoinedRoom.Recording.Stopping'].some(state.matches);
// methods
var startRecording = function startRecording(sourceUrl) {
if (sourceUrl.includes('localhost')) {
return setError('recording is not allowed on localhost');
}
if (isStarting) {
return setError('Please wait.. recording is already starting');
}
if (inProgress) {
return setError('Recording is already in progress');
}
if (isStopping) {
return setError('Please wait.. recording is about to stop');
}
if (!isInsideRoom) {
return setError('Please join a room first');
}
console.log('useRecording() | startRecording() | sourceUrl', {
sourceUrl: sourceUrl
});
send({
type: 'START_RECORDING',
sourceUrl: sourceUrl
});
};
var stopRecording = function stopRecording() {
if (isStarting) {
return setError('Please wait.. recording is about to start');
}
if (isStopping) {
return setError('Please wait.. recording is already stopping');
}
if (!inProgress) {
return setError('Recording is not in progress');
}
if (!isInsideRoom) {
return setError('Please join a room first');
}
send({
type: 'STOP_RECORDING'
});
};
// attributes
startRecording.isCallable = !isStarting && !inProgress && !isStopping && isInsideRoom;
stopRecording.isCallable = inProgress && isInsideRoom;
return {
isStarting: isStarting,
inProgress: inProgress,
isStopping: isStopping,
data: data,
startRecording: startRecording,
stopRecording: stopRecording,
error: error
};
};
var useRoom = function useRoom() {

@@ -182,2 +329,3 @@ var _useMeetingMachine = useMeetingMachine.useMeetingMachine(),

return {
roomId: state.context.roomId,
isLoading: isLoading,

@@ -207,15 +355,19 @@ isRoomJoined: isRoomJoined,

// booleans
var isFetchVideoStream = state.matches('Initialized.JoinedLobby.Cam.Off') && !isLoading;
var isProduceVideo = state.matches('Initialized.JoinedRoom.Cam.NotProducing') && !isLoading;
var isOn = ['Initialized.JoinedRoom.Cam.On', 'Initialized.JoinedLobby.Cam.On'].some(state.matches);
var isOff = ['Initialized.JoinedRoom.Cam.Off', 'Initialized.JoinedLobby.Cam.Off'].some(state.matches);
var isInLobbyOrRoom = ['Initialized.JoinedRoom', 'Initialized.JoinedLobby'].some(state.matches);
var isFetchVideoStream = isOff && !isLoading;
var isProduceVideo = state.matches('Initialized.JoinedRoom.Cam.On') && !isLoading && state.context.camStream;
var isProducing = state.matches('Initialized.JoinedRoom.Cam.ProducingCam');
var isStopProducingVideo = isProducing && !isLoading;
var isStopVideoStream = state.matches('Initialized.JoinedLobby.Cam.On') && !isLoading;
var isStopVideoStream = isOn && !isLoading;
// methods
var fetchVideoStream = function fetchVideoStream() {
if (!state.matches('Initialized.JoinedLobby')) return setError('You are not in the lobby');
if (state.matches('Initialized.JoinedLobby.Cam.On')) return setError('Already Fetched Video Stream');
if (!isInLobbyOrRoom) return setError('You are not in the lobby or room');
if (isOn || state.matches('Initialized.JoinedRoom.Cam.ProducingCam')) return setError('Already Fetched Video Stream');
send('ENABLE_CAM');
};
var produceVideo = function produceVideo(stream) {
if (!state.context.camStream) return setError('No Video Stream');
if (!state.matches('Initialized.JoinedRoom')) return setError('You are not in the room');

@@ -234,4 +386,4 @@ if (state.matches('Initialized.JoinedRoom.Cam.ProducingCam')) return setError('Already Producing Video Stream');

var stopVideoStream = function stopVideoStream() {
if (!state.matches('Initialized.JoinedLobby')) return setError('You are not in the lobby');
if (!state.matches('Initialized.JoinedLobby.Cam.On')) return setError('Already Stopped Video Stream');
if (!['Initialized.JoinedLobby', 'Initialized.JoinedRoom'].some(state.matches)) return setError('You are not in the lobby or room');
if (!isOn) return setError('Already Stopped Video Stream');
send('DISABLE_CAM');

@@ -260,5 +412,7 @@ };

exports.useAudio = useAudio;
exports.useLivestream = useLivestream;
exports.useLobby = useLobby;
exports.usePeers = usePeers;
exports.useRecording = useRecording;
exports.useRoom = useRoom;
exports.useVideo = useVideo;

@@ -7,3 +7,3 @@ 'use strict';

var React = require('react');
var useHuddle01 = require('../../dist/useHuddle01-2c0cb193.cjs.prod.js');
var useHuddle01 = require('../../dist/useHuddle01-1265ff70.cjs.prod.js');
require('@huddle01/web-core');

@@ -30,6 +30,6 @@ require('jotai-xstate');

var isFetchAudioStream = state.matches('Initialized.JoinedLobby.Mic.Muted') && !isLoading;
var isProduceAudio = state.matches('Initialized.JoinedRoom.Mic.NotProducing') && !isLoading;
var isProduceAudio = state.matches('Initialized.JoinedRoom.Mic.Unmuted') && !isLoading && state.context.micStream;
var isProducing = state.matches('Initialized.JoinedRoom.Mic.ProducingMic');
var isStopProducingAudio = isProducing && !isLoading;
var isStopAudioStream = state.matches('Initialized.JoinedLobby.Mic.Unmuted') && !isLoading;
var isStopAudioStream = ['Initialized.JoinedRoom.Mic.Unmuted', 'Initialized.JoinedLobby.Mic.Unmuted'].some(state.matches) && !isLoading;

@@ -43,2 +43,3 @@ // methods

var produceAudio = function produceAudio(stream) {
if (!state.context.micStream) return setError('No Mic Stream');
if (!state.matches('Initialized.JoinedRoom')) return setError('You are not in the room');

@@ -79,2 +80,74 @@ if (state.matches('Initialized.JoinedRoom.Mic.ProducingMic')) return setError('Already Producing Audio Stream');

var useLivestream = function useLivestream() {
var _useMeetingMachine = useMeetingMachine.useMeetingMachine(),
state = _useMeetingMachine.state,
send = _useMeetingMachine.send;
var _useState = React.useState(''),
_useState2 = useMeetingMachine._slicedToArray(_useState, 2),
error = _useState2[0],
setError = _useState2[1];
var data = state.context.livestreamData;
// booleans
var isInsideRoom = state.matches('Initialized.JoinedRoom');
var isStarting = ['Initialized.JoinedRoom.Streaming.RecorderJoining', 'Initialized.JoinedRoom.Streaming.Starting'].some(state.matches);
var inProgress = state.matches('Initialized.JoinedRoom.Streaming.Streaming');
var isStopping = ['Initialized.JoinedRoom.Streaming.RecorderLeaving', 'Initialized.JoinedRoom.Streaming.Stopping'].some(state.matches);
// methods
var startLivestream = function startLivestream(sourceUrl, rtmpEndpoint, type) {
if (sourceUrl.includes('localhost')) {
return setError('Livestreaming is not allowed on localhost');
}
if (isStarting) {
return setError('Please wait.. livestream is already starting');
}
if (inProgress) {
return setError('livestream is already in progress');
}
if (isStopping) {
return setError('Please wait.. livestream is about to stop');
}
if (!isInsideRoom) {
return setError('Please join a room first');
}
send({
type: 'START_STREAMING',
streamingData: {
sourceUrl: sourceUrl,
rtmpEndpoint: rtmpEndpoint,
type: type
}
});
};
var stopLivestream = function stopLivestream() {
if (isStarting) {
return setError('Please wait.. livestream is about to start');
}
if (isStopping) {
return setError('Please wait.. livestream is already stopping');
}
if (!inProgress) {
return setError('Livestream is not in progress');
}
if (!isInsideRoom) {
return setError('Please join a room first');
}
send('STOP_STREAMING');
};
// attributes
startLivestream.isCallable = !isStarting && !inProgress && !isStopping && isInsideRoom;
stopLivestream.isCallable = inProgress && isInsideRoom;
return {
isStarting: isStarting,
inProgress: inProgress,
isStopping: isStopping,
data: data,
startLivestream: startLivestream,
stopLivestream: stopLivestream,
error: error
};
};
var useLobby = function useLobby() {

@@ -95,3 +168,3 @@ var _useMeetingMachine = useMeetingMachine.useMeetingMachine(),

// methods
var joinLobby = function joinLobby(roomId) {
var joinLobby = function joinLobby(roomId, accessToken) {
if (!roomId) {

@@ -105,3 +178,4 @@ return setError('No room id provided');

type: 'JOIN_LOBBY',
roomId: roomId
roomId: roomId,
accessToken: accessToken
});

@@ -153,2 +227,75 @@ };

var useRecording = function useRecording() {
var _useMeetingMachine = useMeetingMachine.useMeetingMachine(),
state = _useMeetingMachine.state,
send = _useMeetingMachine.send;
var _useState = React.useState(''),
_useState2 = useMeetingMachine._slicedToArray(_useState, 2),
error = _useState2[0],
setError = _useState2[1];
var data = state.context.recordingData;
// booleans
var isInsideRoom = state.matches('Initialized.JoinedRoom');
var isStarting = ['Initialized.JoinedRoom.Recording.RecorderJoining', 'Initialized.JoinedRoom.Recording.Starting'].some(state.matches);
var inProgress = state.matches('Initialized.JoinedRoom.Recording.Recording');
var isStopping = ['Initialized.JoinedRoom.Recording.RecorderLeaving', 'Initialized.JoinedRoom.Recording.Stopping'].some(state.matches);
// methods
var startRecording = function startRecording(sourceUrl) {
if (sourceUrl.includes('localhost')) {
return setError('recording is not allowed on localhost');
}
if (isStarting) {
return setError('Please wait.. recording is already starting');
}
if (inProgress) {
return setError('Recording is already in progress');
}
if (isStopping) {
return setError('Please wait.. recording is about to stop');
}
if (!isInsideRoom) {
return setError('Please join a room first');
}
console.log('useRecording() | startRecording() | sourceUrl', {
sourceUrl: sourceUrl
});
send({
type: 'START_RECORDING',
sourceUrl: sourceUrl
});
};
var stopRecording = function stopRecording() {
if (isStarting) {
return setError('Please wait.. recording is about to start');
}
if (isStopping) {
return setError('Please wait.. recording is already stopping');
}
if (!inProgress) {
return setError('Recording is not in progress');
}
if (!isInsideRoom) {
return setError('Please join a room first');
}
send({
type: 'STOP_RECORDING'
});
};
// attributes
startRecording.isCallable = !isStarting && !inProgress && !isStopping && isInsideRoom;
stopRecording.isCallable = inProgress && isInsideRoom;
return {
isStarting: isStarting,
inProgress: inProgress,
isStopping: isStopping,
data: data,
startRecording: startRecording,
stopRecording: stopRecording,
error: error
};
};
var useRoom = function useRoom() {

@@ -182,2 +329,3 @@ var _useMeetingMachine = useMeetingMachine.useMeetingMachine(),

return {
roomId: state.context.roomId,
isLoading: isLoading,

@@ -207,15 +355,19 @@ isRoomJoined: isRoomJoined,

// booleans
var isFetchVideoStream = state.matches('Initialized.JoinedLobby.Cam.Off') && !isLoading;
var isProduceVideo = state.matches('Initialized.JoinedRoom.Cam.NotProducing') && !isLoading;
var isOn = ['Initialized.JoinedRoom.Cam.On', 'Initialized.JoinedLobby.Cam.On'].some(state.matches);
var isOff = ['Initialized.JoinedRoom.Cam.Off', 'Initialized.JoinedLobby.Cam.Off'].some(state.matches);
var isInLobbyOrRoom = ['Initialized.JoinedRoom', 'Initialized.JoinedLobby'].some(state.matches);
var isFetchVideoStream = isOff && !isLoading;
var isProduceVideo = state.matches('Initialized.JoinedRoom.Cam.On') && !isLoading && state.context.camStream;
var isProducing = state.matches('Initialized.JoinedRoom.Cam.ProducingCam');
var isStopProducingVideo = isProducing && !isLoading;
var isStopVideoStream = state.matches('Initialized.JoinedLobby.Cam.On') && !isLoading;
var isStopVideoStream = isOn && !isLoading;
// methods
var fetchVideoStream = function fetchVideoStream() {
if (!state.matches('Initialized.JoinedLobby')) return setError('You are not in the lobby');
if (state.matches('Initialized.JoinedLobby.Cam.On')) return setError('Already Fetched Video Stream');
if (!isInLobbyOrRoom) return setError('You are not in the lobby or room');
if (isOn || state.matches('Initialized.JoinedRoom.Cam.ProducingCam')) return setError('Already Fetched Video Stream');
send('ENABLE_CAM');
};
var produceVideo = function produceVideo(stream) {
if (!state.context.camStream) return setError('No Video Stream');
if (!state.matches('Initialized.JoinedRoom')) return setError('You are not in the room');

@@ -234,4 +386,4 @@ if (state.matches('Initialized.JoinedRoom.Cam.ProducingCam')) return setError('Already Producing Video Stream');

var stopVideoStream = function stopVideoStream() {
if (!state.matches('Initialized.JoinedLobby')) return setError('You are not in the lobby');
if (!state.matches('Initialized.JoinedLobby.Cam.On')) return setError('Already Stopped Video Stream');
if (!['Initialized.JoinedLobby', 'Initialized.JoinedRoom'].some(state.matches)) return setError('You are not in the lobby or room');
if (!isOn) return setError('Already Stopped Video Stream');
send('DISABLE_CAM');

@@ -260,5 +412,7 @@ };

exports.useAudio = useAudio;
exports.useLivestream = useLivestream;
exports.useLobby = useLobby;
exports.usePeers = usePeers;
exports.useRecording = useRecording;
exports.useRoom = useRoom;
exports.useVideo = useVideo;
import { u as useMeetingMachine, _ as _slicedToArray } from '../../dist/useMeetingMachine-789f3ee6.esm.js';
export { u as useMeetingMachine } from '../../dist/useMeetingMachine-789f3ee6.esm.js';
import { useState } from 'react';
export { u as useHuddle01 } from '../../dist/useHuddle01-a87593eb.esm.js';
export { u as useHuddle01 } from '../../dist/useHuddle01-5b7a417e.esm.js';
import '@huddle01/web-core';

@@ -26,6 +26,6 @@ import 'jotai-xstate';

var isFetchAudioStream = state.matches('Initialized.JoinedLobby.Mic.Muted') && !isLoading;
var isProduceAudio = state.matches('Initialized.JoinedRoom.Mic.NotProducing') && !isLoading;
var isProduceAudio = state.matches('Initialized.JoinedRoom.Mic.Unmuted') && !isLoading && state.context.micStream;
var isProducing = state.matches('Initialized.JoinedRoom.Mic.ProducingMic');
var isStopProducingAudio = isProducing && !isLoading;
var isStopAudioStream = state.matches('Initialized.JoinedLobby.Mic.Unmuted') && !isLoading;
var isStopAudioStream = ['Initialized.JoinedRoom.Mic.Unmuted', 'Initialized.JoinedLobby.Mic.Unmuted'].some(state.matches) && !isLoading;

@@ -39,2 +39,3 @@ // methods

var produceAudio = function produceAudio(stream) {
if (!state.context.micStream) return setError('No Mic Stream');
if (!state.matches('Initialized.JoinedRoom')) return setError('You are not in the room');

@@ -75,2 +76,74 @@ if (state.matches('Initialized.JoinedRoom.Mic.ProducingMic')) return setError('Already Producing Audio Stream');

var useLivestream = function useLivestream() {
var _useMeetingMachine = useMeetingMachine(),
state = _useMeetingMachine.state,
send = _useMeetingMachine.send;
var _useState = useState(''),
_useState2 = _slicedToArray(_useState, 2),
error = _useState2[0],
setError = _useState2[1];
var data = state.context.livestreamData;
// booleans
var isInsideRoom = state.matches('Initialized.JoinedRoom');
var isStarting = ['Initialized.JoinedRoom.Streaming.RecorderJoining', 'Initialized.JoinedRoom.Streaming.Starting'].some(state.matches);
var inProgress = state.matches('Initialized.JoinedRoom.Streaming.Streaming');
var isStopping = ['Initialized.JoinedRoom.Streaming.RecorderLeaving', 'Initialized.JoinedRoom.Streaming.Stopping'].some(state.matches);
// methods
var startLivestream = function startLivestream(sourceUrl, rtmpEndpoint, type) {
if (sourceUrl.includes('localhost')) {
return setError('Livestreaming is not allowed on localhost');
}
if (isStarting) {
return setError('Please wait.. livestream is already starting');
}
if (inProgress) {
return setError('livestream is already in progress');
}
if (isStopping) {
return setError('Please wait.. livestream is about to stop');
}
if (!isInsideRoom) {
return setError('Please join a room first');
}
send({
type: 'START_STREAMING',
streamingData: {
sourceUrl: sourceUrl,
rtmpEndpoint: rtmpEndpoint,
type: type
}
});
};
var stopLivestream = function stopLivestream() {
if (isStarting) {
return setError('Please wait.. livestream is about to start');
}
if (isStopping) {
return setError('Please wait.. livestream is already stopping');
}
if (!inProgress) {
return setError('Livestream is not in progress');
}
if (!isInsideRoom) {
return setError('Please join a room first');
}
send('STOP_STREAMING');
};
// attributes
startLivestream.isCallable = !isStarting && !inProgress && !isStopping && isInsideRoom;
stopLivestream.isCallable = inProgress && isInsideRoom;
return {
isStarting: isStarting,
inProgress: inProgress,
isStopping: isStopping,
data: data,
startLivestream: startLivestream,
stopLivestream: stopLivestream,
error: error
};
};
var useLobby = function useLobby() {

@@ -91,3 +164,3 @@ var _useMeetingMachine = useMeetingMachine(),

// methods
var joinLobby = function joinLobby(roomId) {
var joinLobby = function joinLobby(roomId, accessToken) {
if (!roomId) {

@@ -101,3 +174,4 @@ return setError('No room id provided');

type: 'JOIN_LOBBY',
roomId: roomId
roomId: roomId,
accessToken: accessToken
});

@@ -149,2 +223,75 @@ };

var useRecording = function useRecording() {
var _useMeetingMachine = useMeetingMachine(),
state = _useMeetingMachine.state,
send = _useMeetingMachine.send;
var _useState = useState(''),
_useState2 = _slicedToArray(_useState, 2),
error = _useState2[0],
setError = _useState2[1];
var data = state.context.recordingData;
// booleans
var isInsideRoom = state.matches('Initialized.JoinedRoom');
var isStarting = ['Initialized.JoinedRoom.Recording.RecorderJoining', 'Initialized.JoinedRoom.Recording.Starting'].some(state.matches);
var inProgress = state.matches('Initialized.JoinedRoom.Recording.Recording');
var isStopping = ['Initialized.JoinedRoom.Recording.RecorderLeaving', 'Initialized.JoinedRoom.Recording.Stopping'].some(state.matches);
// methods
var startRecording = function startRecording(sourceUrl) {
if (sourceUrl.includes('localhost')) {
return setError('recording is not allowed on localhost');
}
if (isStarting) {
return setError('Please wait.. recording is already starting');
}
if (inProgress) {
return setError('Recording is already in progress');
}
if (isStopping) {
return setError('Please wait.. recording is about to stop');
}
if (!isInsideRoom) {
return setError('Please join a room first');
}
console.log('useRecording() | startRecording() | sourceUrl', {
sourceUrl: sourceUrl
});
send({
type: 'START_RECORDING',
sourceUrl: sourceUrl
});
};
var stopRecording = function stopRecording() {
if (isStarting) {
return setError('Please wait.. recording is about to start');
}
if (isStopping) {
return setError('Please wait.. recording is already stopping');
}
if (!inProgress) {
return setError('Recording is not in progress');
}
if (!isInsideRoom) {
return setError('Please join a room first');
}
send({
type: 'STOP_RECORDING'
});
};
// attributes
startRecording.isCallable = !isStarting && !inProgress && !isStopping && isInsideRoom;
stopRecording.isCallable = inProgress && isInsideRoom;
return {
isStarting: isStarting,
inProgress: inProgress,
isStopping: isStopping,
data: data,
startRecording: startRecording,
stopRecording: stopRecording,
error: error
};
};
var useRoom = function useRoom() {

@@ -178,2 +325,3 @@ var _useMeetingMachine = useMeetingMachine(),

return {
roomId: state.context.roomId,
isLoading: isLoading,

@@ -203,15 +351,19 @@ isRoomJoined: isRoomJoined,

// booleans
var isFetchVideoStream = state.matches('Initialized.JoinedLobby.Cam.Off') && !isLoading;
var isProduceVideo = state.matches('Initialized.JoinedRoom.Cam.NotProducing') && !isLoading;
var isOn = ['Initialized.JoinedRoom.Cam.On', 'Initialized.JoinedLobby.Cam.On'].some(state.matches);
var isOff = ['Initialized.JoinedRoom.Cam.Off', 'Initialized.JoinedLobby.Cam.Off'].some(state.matches);
var isInLobbyOrRoom = ['Initialized.JoinedRoom', 'Initialized.JoinedLobby'].some(state.matches);
var isFetchVideoStream = isOff && !isLoading;
var isProduceVideo = state.matches('Initialized.JoinedRoom.Cam.On') && !isLoading && state.context.camStream;
var isProducing = state.matches('Initialized.JoinedRoom.Cam.ProducingCam');
var isStopProducingVideo = isProducing && !isLoading;
var isStopVideoStream = state.matches('Initialized.JoinedLobby.Cam.On') && !isLoading;
var isStopVideoStream = isOn && !isLoading;
// methods
var fetchVideoStream = function fetchVideoStream() {
if (!state.matches('Initialized.JoinedLobby')) return setError('You are not in the lobby');
if (state.matches('Initialized.JoinedLobby.Cam.On')) return setError('Already Fetched Video Stream');
if (!isInLobbyOrRoom) return setError('You are not in the lobby or room');
if (isOn || state.matches('Initialized.JoinedRoom.Cam.ProducingCam')) return setError('Already Fetched Video Stream');
send('ENABLE_CAM');
};
var produceVideo = function produceVideo(stream) {
if (!state.context.camStream) return setError('No Video Stream');
if (!state.matches('Initialized.JoinedRoom')) return setError('You are not in the room');

@@ -230,4 +382,4 @@ if (state.matches('Initialized.JoinedRoom.Cam.ProducingCam')) return setError('Already Producing Video Stream');

var stopVideoStream = function stopVideoStream() {
if (!state.matches('Initialized.JoinedLobby')) return setError('You are not in the lobby');
if (!state.matches('Initialized.JoinedLobby.Cam.On')) return setError('Already Stopped Video Stream');
if (!['Initialized.JoinedLobby', 'Initialized.JoinedRoom'].some(state.matches)) return setError('You are not in the lobby or room');
if (!isOn) return setError('Already Stopped Video Stream');
send('DISABLE_CAM');

@@ -253,2 +405,2 @@ };

export { useAudio, useLobby, usePeers, useRoom, useVideo };
export { useAudio, useLivestream, useLobby, usePeers, useRecording, useRoom, useVideo };
{
"name": "@huddle01/react",
"version": "0.0.6",
"version": "0.0.7",
"description": "",

@@ -10,3 +10,4 @@ "main": "dist/huddle01-react.cjs.js",

"components",
"hooks"
"hooks",
"app-utils"
],

@@ -40,3 +41,3 @@ "scripts": {

"dependencies": {
"@huddle01/web-core": "^0.0.4",
"@huddle01/web-core": "^0.0.5",
"@xstate/inspect": "^0.7.1",

@@ -54,5 +55,6 @@ "@xstate/react": "^3.2.1",

"components/index.ts",
"hooks/index.ts"
"hooks/index.ts",
"app-utils/index.ts"
]
}
}

@@ -48,9 +48,11 @@ # Huddle01 React SDK

After installing the package, you can initialize the SDK by using the **`useHuddle01Web`** hook:
After installing the package, you can initialize the SDK by using the **`useHuddle01`** hook:
```jsx
import { useHuddle01Web } from '@huddle01/react';
import { useHuddle01 } from '@huddle01/react';
function App() {
const { state, send } = useHuddle01Web();
const { initialize } = useHuddle01();
initialize('YOUR_PROJECT_ID');
}

@@ -67,3 +69,3 @@ ```

Initialises and sets up the app state required by the library. This method should be invoked first at all times.
initializes and sets up the app state required by the library. This method should be invoked first at all times.

@@ -70,0 +72,0 @@ ๐Ÿ’ก For more information head to https://huddle01.com/docs

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc