@lookit/record 4.0.0 → 5.0.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/dist/index.d.ts CHANGED
@@ -132,6 +132,11 @@ declare const info$3: {
132
132
  readonly default: false;
133
133
  };
134
134
  };
135
+ readonly data: {
136
+ readonly chs_type: {
137
+ readonly type: ParameterType.STRING;
138
+ };
139
+ };
135
140
  };
136
141
  type Info$3 = typeof info$3;
137
142
  /** The video consent plugin. */
@@ -269,6 +274,11 @@ declare class VideoConsentPlugin implements JsPsychPlugin<Info$3> {
269
274
  readonly default: false;
270
275
  };
271
276
  };
277
+ readonly data: {
278
+ readonly chs_type: {
279
+ readonly type: ParameterType.STRING;
280
+ };
281
+ };
272
282
  };
273
283
  private readonly recorder;
274
284
  private readonly video_container_id;
@@ -393,7 +403,32 @@ declare class VideoConsentPlugin implements JsPsychPlugin<Info$3> {
393
403
 
394
404
  declare const info$2: {
395
405
  readonly name: "start-record-plugin";
396
- readonly parameters: {};
406
+ readonly version: string;
407
+ readonly parameters: {
408
+ /**
409
+ * This string can contain HTML markup. Any content provided will be
410
+ * displayed while the video recording connection is established. If null
411
+ * (the default), then the default 'establishing video connection, please
412
+ * wait' (or appropriate translation based on 'locale') will be displayed.
413
+ * Use a blank string for no message/content.
414
+ */
415
+ readonly wait_for_connection_message: {
416
+ readonly type: ParameterType.HTML_STRING;
417
+ readonly default: string | null;
418
+ };
419
+ /**
420
+ * Locale code used for translating the default 'establishing video
421
+ * connection, please wait' message. This code must be present in the
422
+ * translation files. If the code is not found then English will be used. If
423
+ * the 'wait_for_connection_message' parameter is specified then this value
424
+ * is ignored.
425
+ */
426
+ readonly locale: {
427
+ readonly type: ParameterType.STRING;
428
+ readonly default: "en-us";
429
+ };
430
+ };
431
+ readonly data: {};
397
432
  };
398
433
  type Info$2 = typeof info$2;
399
434
  /** Start recording. Used by researchers who want to record across trials. */
@@ -401,7 +436,32 @@ declare class StartRecordPlugin implements JsPsychPlugin<Info$2> {
401
436
  private jsPsych;
402
437
  static readonly info: {
403
438
  readonly name: "start-record-plugin";
404
- readonly parameters: {};
439
+ readonly version: string;
440
+ readonly parameters: {
441
+ /**
442
+ * This string can contain HTML markup. Any content provided will be
443
+ * displayed while the video recording connection is established. If null
444
+ * (the default), then the default 'establishing video connection, please
445
+ * wait' (or appropriate translation based on 'locale') will be displayed.
446
+ * Use a blank string for no message/content.
447
+ */
448
+ readonly wait_for_connection_message: {
449
+ readonly type: ParameterType.HTML_STRING;
450
+ readonly default: string | null;
451
+ };
452
+ /**
453
+ * Locale code used for translating the default 'establishing video
454
+ * connection, please wait' message. This code must be present in the
455
+ * translation files. If the code is not found then English will be used. If
456
+ * the 'wait_for_connection_message' parameter is specified then this value
457
+ * is ignored.
458
+ */
459
+ readonly locale: {
460
+ readonly type: ParameterType.STRING;
461
+ readonly default: "en-us";
462
+ };
463
+ };
464
+ readonly data: {};
405
465
  };
406
466
  private recorder;
407
467
  /**
@@ -410,18 +470,53 @@ declare class StartRecordPlugin implements JsPsychPlugin<Info$2> {
410
470
  * @param jsPsych - Object provided by jsPsych.
411
471
  */
412
472
  constructor(jsPsych: JsPsych);
413
- /** Trial function called by jsPsych. */
414
- trial(): void;
473
+ /**
474
+ * Trial function called by jsPsych.
475
+ *
476
+ * @param display_element - DOM element where jsPsych content is being
477
+ * rendered (set in initJsPsych and automatically made available to a
478
+ * plugin's trial method via jsPsych core).
479
+ * @param trial - Trial object with parameters/values.
480
+ */
481
+ trial(display_element: HTMLElement, trial: TrialType<Info$2>): Promise<void>;
415
482
  }
416
483
 
417
484
  declare const info$1: {
418
485
  readonly name: "stop-record-plugin";
486
+ readonly version: string;
419
487
  readonly parameters: {
488
+ /**
489
+ * This string can contain HTML markup. Any content provided will be
490
+ * displayed while the recording is uploading. If null (the default), then
491
+ * the default 'uploading video, please wait' (or appropriate translation
492
+ * based on 'locale') will be displayed. Use a blank string for no
493
+ * message/content.
494
+ */
495
+ readonly wait_for_upload_message: {
496
+ readonly type: ParameterType.HTML_STRING;
497
+ readonly default: string | null;
498
+ };
499
+ /**
500
+ * Locale code used for translating the default 'uploading video, please
501
+ * wait' message. This code must be present in the translation files. If the
502
+ * code is not found then English will be used. If the
503
+ * 'wait_for_upload_message' parameter is specified then this value is
504
+ * ignored.
505
+ */
420
506
  readonly locale: {
421
507
  readonly type: ParameterType.STRING;
422
508
  readonly default: "en-us";
423
509
  };
510
+ /**
511
+ * Maximum duration (in seconds) to wait for the session recording to finish
512
+ * uploading before continuing with the experiment.
513
+ */
514
+ readonly max_upload_seconds: {
515
+ readonly type: ParameterType.INT;
516
+ readonly default: 10;
517
+ };
424
518
  };
519
+ readonly data: {};
425
520
  };
426
521
  type Info$1 = typeof info$1;
427
522
  /** Stop recording. Used by researchers who want to record across trials. */
@@ -429,12 +524,40 @@ declare class StopRecordPlugin implements JsPsychPlugin<Info$1> {
429
524
  private jsPsych;
430
525
  static readonly info: {
431
526
  readonly name: "stop-record-plugin";
527
+ readonly version: string;
432
528
  readonly parameters: {
529
+ /**
530
+ * This string can contain HTML markup. Any content provided will be
531
+ * displayed while the recording is uploading. If null (the default), then
532
+ * the default 'uploading video, please wait' (or appropriate translation
533
+ * based on 'locale') will be displayed. Use a blank string for no
534
+ * message/content.
535
+ */
536
+ readonly wait_for_upload_message: {
537
+ readonly type: ParameterType.HTML_STRING;
538
+ readonly default: string | null;
539
+ };
540
+ /**
541
+ * Locale code used for translating the default 'uploading video, please
542
+ * wait' message. This code must be present in the translation files. If the
543
+ * code is not found then English will be used. If the
544
+ * 'wait_for_upload_message' parameter is specified then this value is
545
+ * ignored.
546
+ */
433
547
  readonly locale: {
434
548
  readonly type: ParameterType.STRING;
435
549
  readonly default: "en-us";
436
550
  };
551
+ /**
552
+ * Maximum duration (in seconds) to wait for the session recording to finish
553
+ * uploading before continuing with the experiment.
554
+ */
555
+ readonly max_upload_seconds: {
556
+ readonly type: ParameterType.INT;
557
+ readonly default: 10;
558
+ };
437
559
  };
560
+ readonly data: {};
438
561
  };
439
562
  private recorder;
440
563
  /**
@@ -451,15 +574,49 @@ declare class StopRecordPlugin implements JsPsychPlugin<Info$1> {
451
574
  * plugin's trial method via jsPsych core).
452
575
  * @param trial - Trial object with parameters/values.
453
576
  */
454
- trial(display_element: HTMLElement, trial: TrialType<Info$1>): void;
577
+ trial(display_element: HTMLElement, trial: TrialType<Info$1>): Promise<void>;
455
578
  }
456
579
 
457
- /** This extension will allow reasearchers to record trials. */
580
+ interface Parameters {
581
+ /**
582
+ * Content that should be displayed while the recording is uploading. If null
583
+ * (the default), then the default 'uploading video, please wait...' (or
584
+ * appropriate translation based on 'locale') will be displayed. Use a blank
585
+ * string for no message/content. Otherwise this parameter can be set to a
586
+ * custom string and can contain HTML markup. If you want to embed
587
+ * images/video/audio in this HTML string, be sure to preload the media files
588
+ * with the `preload` plugin and manual preloading. Use a blank string (`""`)
589
+ * for no message/content.
590
+ *
591
+ * @default null
592
+ */
593
+ wait_for_upload_message?: null | string;
594
+ /**
595
+ * Locale code used for translating the default 'uploading video, please
596
+ * wait...' message. This code must be present in the translation files. If
597
+ * the code is not found then English will be used. If the
598
+ * 'wait_for_upload_message' parameter is specified then this value is
599
+ * ignored.
600
+ *
601
+ * @default "en-us"
602
+ */
603
+ locale?: string;
604
+ /**
605
+ * Maximum duration (in seconds) to wait for the trial recording to finish
606
+ * uploading before continuing with the experiment. Default is 10 seconds (set
607
+ * during initialize).
608
+ */
609
+ max_upload_seconds?: null | number;
610
+ }
611
+ /** This extension allows researchers to record webcam audio/video during trials. */
458
612
  declare class TrialRecordExtension implements JsPsychExtension {
459
613
  private jsPsych;
460
614
  static readonly info: JsPsychExtensionInfo;
461
615
  private recorder?;
462
616
  private pluginName;
617
+ private uploadMsg;
618
+ private locale;
619
+ private maxUploadSeconds;
463
620
  /**
464
621
  * Video recording extension.
465
622
  *
@@ -467,20 +624,34 @@ declare class TrialRecordExtension implements JsPsychExtension {
467
624
  */
468
625
  constructor(jsPsych: JsPsych);
469
626
  /**
470
- * Ran on the initialize step for extensions, called when an instance of
627
+ * Runs on the initialize step for extensions, called when an instance of
471
628
  * jsPsych is first initialized through initJsPsych().
629
+ *
630
+ * @param params - Parameters object
631
+ * @param params.wait_for_upload_message - Message to display while waiting
632
+ * for upload. String or null (default)
633
+ * @param params.locale - Message to display while waiting for upload. String
634
+ * or null (default).
635
+ */
636
+ initialize(params?: Parameters): Promise<void>;
637
+ /**
638
+ * Runs at the start of a trial.
639
+ *
640
+ * @param startParams - Parameters object
641
+ * @param startParams.wait_for_upload_message - Message to display while
642
+ * waiting for upload. String or null (default). If given, this will
643
+ * overwrite the value used during initialization.
472
644
  */
473
- initialize(): Promise<void>;
474
- /** Ran at the start of a trial. */
475
- on_start(): void;
476
- /** Ran when the trial has loaded. */
645
+ on_start(startParams?: Parameters): void;
646
+ /** Runs when the trial has loaded. */
477
647
  on_load(): void;
478
648
  /**
479
- * Ran when trial has finished.
649
+ * Runs when trial has finished.
480
650
  *
481
- * @returns Trial data.
651
+ * @returns Any data from the trial extension that should be added to the rest
652
+ * of the trial data.
482
653
  */
483
- on_finish(): {};
654
+ on_finish(): Promise<{}>;
484
655
  /**
485
656
  * Gets the plugin name for the trial that is being extended. This is same as
486
657
  * the "trial_type" value that is stored in the data for this trial.