@@ -4,7 +4,7 @@ import axios from "axios";
44import { Actions as ConferenceActions } from "./ConferenceActions" ;
55import { Actions as ParticipantActions } from "./ParticipantActions" ;
66import { Actions as ParticipantWaitingActions } from "./ParticipantWaitingActions" ;
7- import { Actions as ParticipantRecordActions } from "./ParticipantRecordActions " ;
7+ import { Actions as VideoPresentationActions } from "./VideoPresentationActions " ;
88
99export const Types = {
1010 CONFERENCE_LEAVE : "CONFERENCE_LEAVE" ,
@@ -63,12 +63,12 @@ export class Actions {
6363 static join (
6464 conferenceId ,
6565 constraints ,
66+ catToken ,
6667 userInfo ,
6768 userData ,
6869 userParams ,
6970 mediaRecordedUrl ,
7071 thirdPartyId ,
71- splitRecording ,
7272 language
7373 ) {
7474 return ( dispatch , getState ) => {
@@ -83,27 +83,17 @@ export class Actions {
8383 return VoxeetSDK . conference
8484 . join ( conference , {
8585 constraints,
86+ conferenceAccessToken :
87+ catToken && catToken . length > 0 ? catToken : null ,
8688 mixing : {
8789 enabled : true ,
8890 } ,
8991 userParams,
90- audio3D : false ,
9192 } )
9293 . then ( ( payload ) => {
93- console . log ( "Split Recording Activated : " + splitRecording ) ;
9494 console . log ( "Media Recorded Url : " + mediaRecordedUrl ) ;
9595 console . log ( "User Params : " + userParams ) ;
9696 console . log ( "User Data : " + userData ) ;
97- dispatch (
98- ParticipantRecordActions . saveDataForRecord (
99- payload . conferenceId ,
100- userData ,
101- mediaRecordedUrl ,
102- thirdPartyId ,
103- splitRecording ,
104- language
105- )
106- ) ;
10797 } )
10898 . catch ( ) ;
10999 } )
@@ -116,12 +106,12 @@ export class Actions {
116106 static replay (
117107 conferenceId ,
118108 offset ,
109+ catToken ,
119110 userInfo ,
120111 userData ,
121112 userParams ,
122113 mediaRecordedUrl ,
123114 thirdPartyId ,
124- splitRecording ,
125115 language
126116 ) {
127117 return ( dispatch ) => {
@@ -132,19 +122,16 @@ export class Actions {
132122 . fetch ( conferenceId )
133123 . then ( ( conference ) => {
134124 return VoxeetSDK . conference
135- . replay ( conference , offset , { enabled : true } )
136- . then ( ( payload ) => {
137- dispatch (
138- ParticipantRecordActions . saveDataForRecord (
139- payload . id ,
140- userData ,
141- mediaRecordedUrl ,
142- thirdPartyId ,
143- splitRecording ,
144- language
145- )
146- ) ;
147- } )
125+ . replay (
126+ conference ,
127+ {
128+ offset : offset ,
129+ conferenceAccessToken :
130+ catToken && catToken . length > 0 ? catToken : null ,
131+ } ,
132+ { enabled : true }
133+ )
134+ . then ( ( payload ) => { } )
148135 . catch ( ) ;
149136 } )
150137 . catch ( ) ;
@@ -355,6 +342,10 @@ export class Actions {
355342 data . timestamp / 1000
356343 )
357344 ) ;
345+ dispatch ( VideoPresentationActions . play ( ) ) ;
346+ setTimeout ( ( ) => {
347+ dispatch ( VideoPresentationActions . seek ( data . timestamp / 1000 ) ) ;
348+ } , 250 ) ;
358349 } ;
359350 }
360351
@@ -393,89 +384,6 @@ export class Actions {
393384 } ;
394385 }
395386
396- static checkIfRecordStart ( userId , stream ) {
397- return ( dispatch , getState ) => {
398- const {
399- voxeet : { participantsWaiting, participantsRecord } ,
400- } = getState ( ) ;
401- const indexParticipantRecord = participantsRecord . participantsRecord . findIndex (
402- ( p ) => p . userId === userId
403- ) ;
404- const indexParticipant = participantsWaiting . participants . findIndex (
405- ( p ) => p . participant_id === userId
406- ) ;
407- if ( stream != null ) {
408- if ( indexParticipantRecord == - 1 ) {
409- console . log ( "START NEW RECORD FOR USER " + userId ) ;
410- dispatch (
411- ParticipantRecordActions . onParticipantPeerRecordStart (
412- userId ,
413- stream ,
414- participantsWaiting . participants [ indexParticipant ] . metadata
415- )
416- ) ;
417- } else {
418- console . log ( "UPDATE RECORD FOR USER " + userId ) ;
419- dispatch (
420- ParticipantRecordActions . onParticipantPeerRecordUpdate (
421- userId ,
422- stream
423- )
424- ) ;
425- }
426- }
427- } ;
428- }
429-
430- static filterAndHandleConferenceEnded ( data ) {
431- return ( dispatch , getState ) => {
432- const {
433- voxeet : { participantsRecord } ,
434- } = getState ( ) ;
435- //if (data.conferenceId == participantsRecord.conferenceId) {
436- dispatch ( this . killAllRecord ( ) ) ;
437- dispatch ( this . _conferenceEnded ( ) ) ;
438- //}
439- } ;
440- }
441-
442- static checkIfRecordUpdate ( userId , stream ) {
443- return ( dispatch , getState ) => {
444- const {
445- voxeet : { participants } ,
446- } = getState ( ) ;
447- const index = participants . participants . findIndex (
448- ( p ) => p . participant_id === userId
449- ) ;
450- if ( stream != null ) {
451- console . log ( "UPDATE RECORD FOR USER " + userId ) ;
452- dispatch (
453- ParticipantRecordActions . onParticipantPeerRecordUpdate ( userId , stream )
454- ) ;
455- }
456- } ;
457- }
458-
459- static checkIncrementRecord ( userId , status ) {
460- return ( dispatch , getState ) => {
461- const {
462- voxeet : { participants } ,
463- } = getState ( ) ;
464- const index = participants . participants . findIndex (
465- ( p ) => p . participant_id === userId
466- ) ;
467- if ( index == - 1 && status == "Inactive" ) return ;
468- if (
469- index != - 1 &&
470- participants . participants [ index ] . status == "Left" &&
471- status == "Connected"
472- ) {
473- console . log ( "INCREMENT PARTICIPANT RECORD FOR USER " + userId ) ;
474- dispatch ( ParticipantRecordActions . incrementParticipantRecord ( userId ) ) ;
475- }
476- } ;
477- }
478-
479387 static checkIfUserJoined ( userId , stream ) {
480388 return ( dispatch , getState ) => {
481389 const {
@@ -503,22 +411,6 @@ export class Actions {
503411 } ;
504412 }
505413
506- static killAllRecord ( ) {
507- return ( dispatch , getState ) => {
508- console . log ( "KILL ALL RECORD" ) ;
509- const {
510- voxeet : { participantsRecord } ,
511- } = getState ( ) ;
512- participantsRecord . participantsRecord . map ( ( participant ) => {
513- dispatch (
514- ParticipantRecordActions . onParticipantPeerRecordStop (
515- participant . userId
516- )
517- ) ;
518- } ) ;
519- } ;
520- }
521-
522414 static _initializeListeners ( dispatch ) {
523415 return new Promise ( ( resolve , reject ) => {
524416 VoxeetSDK . conference . on ( "participantAdded" , ( participant ) => {
@@ -537,7 +429,7 @@ export class Actions {
537429
538430 VoxeetSDK . conference . on ( "ended" , ( data ) => {
539431 console . log ( "CONFERENCE ENDED" ) ;
540- dispatch ( this . filterAndHandleConferenceEnded ( data ) ) ;
432+ dispatch ( this . _conferenceEnded ( ) ) ;
541433 } ) ;
542434
543435 VoxeetSDK . videoPresentation . on ( "started" , ( data ) => {
@@ -555,7 +447,6 @@ export class Actions {
555447 } ) ;
556448
557449 VoxeetSDK . recording . on ( "stop" , ( ) => {
558- dispatch ( this . killAllRecord ( ) ) ;
559450 console . log ( "RECORDING STOPPED" ) ;
560451 } ) ;
561452
@@ -567,32 +458,33 @@ export class Actions {
567458
568459 VoxeetSDK . videoPresentation . on ( "played" , ( data ) => {
569460 console . log ( "VIDEO PRESENTATION PLAY: " + data . timestamp ) ;
570- var videoPresentation = document . getElementById (
571- "video-file-presentation"
572- ) ;
573- videoPresentation . currentTime = data . timestamp / 1000 ;
574- videoPresentation . play ( ) ;
461+ dispatch ( VideoPresentationActions . play ( ) ) ;
462+ setTimeout ( ( ) => {
463+ dispatch ( VideoPresentationActions . seek ( data . timestamp / 1000 ) ) ;
464+ } , 250 ) ;
575465 } ) ;
576466
577467 VoxeetSDK . videoPresentation . on ( "paused" , ( data ) => {
578468 console . log ( "VIDEO PRESENTATION PAUSE: " + data . timestamp ) ;
579- var videoPresentation = document . getElementById (
580- "video-file-presentation"
581- ) ;
582- videoPresentation . currentTime = data . timestamp / 1000 ;
583- videoPresentation . pause ( ) ;
469+ dispatch ( VideoPresentationActions . pause ( ) ) ;
584470 } ) ;
585471
586472 VoxeetSDK . videoPresentation . on ( "sought" , ( data ) => {
587473 console . log ( "VIDEO PRESENTATION SEEK: " + data . timestamp ) ;
588- var videoPresentation = document . getElementById (
589- "video-file-presentation"
590- ) ;
591- videoPresentation . currentTime = data . timestamp / 1000 ;
474+ dispatch ( VideoPresentationActions . seek ( data . timestamp / 1000 ) ) ;
475+ } ) ;
476+
477+ VoxeetSDK . conference . on ( "error" , ( error ) => {
478+ if ( error . name === "PeerConnectionDisconnectedError" ) {
479+ console . log ( "AN ERROR HAS BEEN HANDLED ON PEER CONNECTION" ) ;
480+ // console.log("CONFERENCE ENDED");
481+ // dispatch(this.killAllRecord());
482+ // dispatch(this._conferenceEnded());
483+ }
592484 } ) ;
593485
594486 VoxeetSDK . conference . on ( "streamAdded" , ( participant , stream ) => {
595- if ( stream . type === "ScreenShare" ) {
487+ if ( stream && stream . type === "ScreenShare" ) {
596488 dispatch (
597489 this . checkIfUserExistScreenShareStart ( participant . id , stream )
598490 ) ;
@@ -609,7 +501,6 @@ export class Actions {
609501
610502 VoxeetSDK . conference . on ( "streamUpdated" , ( participant , stream ) => {
611503 console . log ( "PARTICIPANT UPDATED: " + participant . id ) ;
612- dispatch ( this . checkIfRecordUpdate ( participant . id , stream ) ) ;
613504 dispatch ( this . checkIfUpdateUser ( participant . id , stream ) ) ;
614505 } ) ;
615506
@@ -624,9 +515,6 @@ export class Actions {
624515 ParticipantWaitingActions . onParticipantWaitingLeft ( participant . id )
625516 ) ;
626517 dispatch ( ParticipantActions . onParticipantLeft ( participant . id ) ) ;
627- dispatch (
628- ParticipantRecordActions . onParticipantPeerRecordStop ( participant . id )
629- ) ;
630518 }
631519 } ) ;
632520
0 commit comments