validate method
void
validate()
Implementation
void validate() {
if (!RegExp(r'^[a-z][a-z0-9_-]{0,63}$').hasMatch(playerId)) {
throw const FormatException('Invalid media playback playerId.');
}
if (position.isNegative ||
duration?.isNegative == true ||
buffered.isNegative) {
throw const FormatException(
'Media playback durations must not be negative.',
);
}
if (!volume.isFinite || volume < 0 || volume > 1) {
throw const FormatException('Media playback volume must be 0-1.');
}
if (!speed.isFinite || speed < 0.25 || speed > 3) {
throw const FormatException('Media playback speed must be 0.25-3.');
}
}