Skip to content

MediaSamplingPackage

The sampling package for capturing audio (incl. noise) and video (incl. images).

Register it before you deploy a protocol that uses its measure types:

SamplingPackageRegistry().register(MediaSamplingPackage());

Key points:

  • AUDIO and NOISE use the microphone and request the microphone permission.
  • VIDEO and IMAGE do not collect anything themselves. The app records the media and must request the camera permission itself (see VideoProbe).
  • Media files are stored in the MEDIA_FILES_PATH folder of the deployment's data folder.

See also AudioProbe and NoiseProbe.

Inheritance

Constructors

MediaSamplingPackage

MediaSamplingPackage()

Constants

AUDIO

String const AUDIO

Measure type for one-time collection of audio from the phone's microphone.

  • One-time measure.
  • Uses the Smartphone primary device for data collection.
  • No sampling configuration needed.
  • Collected as AudioMedia data.

IMAGE

String const IMAGE

Measure type for an image captured by the app (ImageMedia).

  • One-time measure.
  • Uses the Smartphone primary device.
  • The app creates the measurement; VideoProbe only acts as a placeholder.

MEDIA_FILES_PATH

String const MEDIA_FILES_PATH

The name of the folder used for storing media files.

NOISE

String const NOISE

Measure type for periodic collection of noise data from the phone's microphone.

VIDEO

String const VIDEO

Measure type for a video recorded by the app (VideoMedia).

  • One-time measure.
  • Uses the Smartphone primary device.
  • The app creates the measurement; VideoProbe only acts as a placeholder.

Properties

samplingSchemes

DataTypeSamplingSchemeMap get samplingSchemes
override

The default sampling schemes for all dataTypes in this package.

All sampling packages should defined a DataTypeSamplingScheme for each data type.

Methods

create

Probe? create(
  1. String type
)
override

Creates a new Probe of the specified type. Note that type should be one of the dataTypes that this package supports. Returns null if a probe cannot be created for the type.

onRegister

void onRegister()
override

Callback method when this package is being registered.