@@ -1233,48 +1233,11 @@ export class StreamingService
1233
1233
}
1234
1234
1235
1235
toggleRecording ( ) {
1236
- // stop recording
1236
+ /**
1237
+ * START SINGLE OUTPUT RECORDING
1238
+ * Note: Comment out the below and comment in the dual output recording code block to enable dual output recording
1239
+ */
1237
1240
if (
1238
- this . state . status . horizontal . recording === ERecordingState . Recording &&
1239
- this . state . status . vertical . recording === ERecordingState . Recording
1240
- ) {
1241
- // stop recording both displays
1242
- let time = new Date ( ) . toISOString ( ) ;
1243
-
1244
- if ( this . contexts . vertical . recording !== null ) {
1245
- const recordingStopped = this . recordingStopped . subscribe ( async ( ) => {
1246
- await new Promise ( resolve =>
1247
- // sleep for 2 seconds to allow a different time stamp to be generated
1248
- // because the recording history uses the time stamp as keys
1249
- // if the same time stamp is used, the entry will be replaced in the recording history
1250
- setTimeout ( ( ) => {
1251
- time = new Date ( ) . toISOString ( ) ;
1252
- this . SET_RECORDING_STATUS ( ERecordingState . Stopping , 'horizontal' , time ) ;
1253
- if ( this . contexts . horizontal . recording !== null ) {
1254
- this . contexts . horizontal . recording . stop ( ) ;
1255
- }
1256
- } , 2000 ) ,
1257
- ) ;
1258
- recordingStopped . unsubscribe ( ) ;
1259
- } ) ;
1260
-
1261
- this . SET_RECORDING_STATUS ( ERecordingState . Stopping , 'vertical' , time ) ;
1262
- this . contexts . vertical . recording . stop ( ) ;
1263
- this . recordingStopped . next ( ) ;
1264
- }
1265
-
1266
- return ;
1267
- } else if (
1268
- this . state . status . vertical . recording === ERecordingState . Recording &&
1269
- this . contexts . vertical . recording !== null
1270
- ) {
1271
- // stop recording vertical display
1272
- // change the recording status for the loading animation
1273
- this . SET_RECORDING_STATUS ( ERecordingState . Stopping , 'vertical' , new Date ( ) . toISOString ( ) ) ;
1274
-
1275
- this . contexts . vertical . recording . stop ( true ) ;
1276
- return ;
1277
- } else if (
1278
1241
this . state . status . horizontal . recording === ERecordingState . Recording &&
1279
1242
this . contexts . horizontal . recording !== null
1280
1243
) {
@@ -1283,28 +1246,101 @@ export class StreamingService
1283
1246
this . SET_RECORDING_STATUS ( ERecordingState . Stopping , 'horizontal' , new Date ( ) . toISOString ( ) ) ;
1284
1247
this . contexts . horizontal . recording . stop ( true ) ;
1285
1248
return ;
1249
+ } else if ( this . state . status . horizontal . recording === ERecordingState . Offline ) {
1250
+ this . validateOrCreateOutputInstance ( 'horizontal' , 'recording' , 1 , true ) ;
1251
+ } else {
1252
+ throwStreamError (
1253
+ 'UNKNOWN_STREAMING_ERROR_WITH_MESSAGE' ,
1254
+ { } ,
1255
+ 'Unable to create replay buffer instance' ,
1256
+ ) ;
1286
1257
}
1287
1258
1288
- // start recording
1289
- if (
1290
- this . state . status . horizontal . recording === ERecordingState . Offline &&
1291
- this . state . status . vertical . recording === ERecordingState . Offline
1292
- ) {
1293
- if ( this . views . isDualOutputMode ) {
1294
- if ( this . state . streamingStatus !== EStreamingState . Offline ) {
1295
- // In dual output mode, if the streaming status is starting then this call to toggle recording came from the function to toggle streaming.
1296
- // In this case, only stream the horizontal display (don't record the horizontal display) and record the vertical display.
1297
- this . validateOrCreateOutputInstance ( 'vertical' , 'recording' , 2 , true ) ;
1298
- } else {
1299
- // Otherwise, record both displays in dual output mode
1300
- this . validateOrCreateOutputInstance ( 'vertical' , 'recording' , 2 , true ) ;
1301
- this . validateOrCreateOutputInstance ( 'horizontal' , 'recording' , 1 , true ) ;
1302
- }
1303
- } else {
1304
- // In single output mode, recording only the horizontal display
1305
- this . validateOrCreateOutputInstance ( 'horizontal' , 'recording' , 1 , true ) ;
1306
- }
1307
- }
1259
+ /**
1260
+ * END SINGLE OUTPUT RECORDING
1261
+ */
1262
+
1263
+ /**
1264
+ * START DUAL OUTPUT RECORDING BELOW
1265
+ * Note: Comment in the below and comment out the single output recording code block to enable dual output recording
1266
+ */
1267
+
1268
+ // stop recording
1269
+ // if (
1270
+ // this.state.status.horizontal.recording === ERecordingState.Recording &&
1271
+ // this.state.status.vertical.recording === ERecordingState.Recording
1272
+ // ) {
1273
+ // // stop recording both displays
1274
+ // let time = new Date().toISOString();
1275
+
1276
+ // if (this.contexts.vertical.recording !== null) {
1277
+ // const recordingStopped = this.recordingStopped.subscribe(async () => {
1278
+ // await new Promise(resolve =>
1279
+ // // sleep for 2 seconds to allow a different time stamp to be generated
1280
+ // // because the recording history uses the time stamp as keys
1281
+ // // if the same time stamp is used, the entry will be replaced in the recording history
1282
+ // setTimeout(() => {
1283
+ // time = new Date().toISOString();
1284
+ // this.SET_RECORDING_STATUS(ERecordingState.Stopping, 'horizontal', time);
1285
+ // if (this.contexts.horizontal.recording !== null) {
1286
+ // this.contexts.horizontal.recording.stop();
1287
+ // }
1288
+ // }, 2000),
1289
+ // );
1290
+ // recordingStopped.unsubscribe();
1291
+ // });
1292
+
1293
+ // this.SET_RECORDING_STATUS(ERecordingState.Stopping, 'vertical', time);
1294
+ // this.contexts.vertical.recording.stop();
1295
+ // this.recordingStopped.next();
1296
+ // }
1297
+
1298
+ // return;
1299
+ // } else if (
1300
+ // this.state.status.vertical.recording === ERecordingState.Recording &&
1301
+ // this.contexts.vertical.recording !== null
1302
+ // ) {
1303
+ // // stop recording vertical display
1304
+ // // change the recording status for the loading animation
1305
+ // this.SET_RECORDING_STATUS(ERecordingState.Stopping, 'vertical', new Date().toISOString());
1306
+
1307
+ // this.contexts.vertical.recording.stop(true);
1308
+ // return;
1309
+ // } else if (
1310
+ // this.state.status.horizontal.recording === ERecordingState.Recording &&
1311
+ // this.contexts.horizontal.recording !== null
1312
+ // ) {
1313
+ // // stop recording horizontal display
1314
+ // // change the recording status for the loading animation
1315
+ // this.SET_RECORDING_STATUS(ERecordingState.Stopping, 'horizontal', new Date().toISOString());
1316
+ // this.contexts.horizontal.recording.stop(true);
1317
+ // return;
1318
+ // }
1319
+
1320
+ // // start recording
1321
+ // if (
1322
+ // this.state.status.horizontal.recording === ERecordingState.Offline &&
1323
+ // this.state.status.vertical.recording === ERecordingState.Offline
1324
+ // ) {
1325
+ // if (this.views.isDualOutputMode) {
1326
+ // if (this.state.streamingStatus !== EStreamingState.Offline) {
1327
+ // // In dual output mode, if the streaming status is starting then this call to toggle recording came from the function to toggle streaming.
1328
+ // // In this case, only stream the horizontal display (don't record the horizontal display) and record the vertical display.
1329
+ // this.validateOrCreateOutputInstance('vertical', 'recording', 2, true);
1330
+ // } else {
1331
+ // // Otherwise, record both displays in dual output mode
1332
+ // this.validateOrCreateOutputInstance('vertical', 'recording', 2, true);
1333
+ // this.validateOrCreateOutputInstance('horizontal', 'recording', 1, true);
1334
+ // }
1335
+ // } else {
1336
+ // // In single output mode, recording only the horizontal display
1337
+ // this.validateOrCreateOutputInstance('horizontal', 'recording', 1, true);
1338
+ // }
1339
+ // }
1340
+
1341
+ /**
1342
+ * END DUAL OUTPUT RECORDING
1343
+ */
1308
1344
}
1309
1345
1310
1346
/**
0 commit comments