Source
@override
bool get paused {
return _paused;
}
Source
@override
set paused(bool value) {
if (_paused == value) {
// nothing has changed
} else if (_stopped) {
// we can't pause/resume the audio playback.
_paused = _stopped || value;
} else if (value){
_position = this.position;
_paused = true;
_sourceNode.stop(0);
_stopCompleteTimer();
} else if (_loop) {
_paused = false;
_sourceNode = WebAudioApiMixer.audioContext.createBufferSource();
_sourceNode.buffer = _webAudioApiSound._audioBuffer;
_sourceNode.loop = true;
_sourceNode.loopStart = _startTime;
_sourceNode.loopEnd = _startTime + _duration;
_sourceNode.connectNode(_webAudioApiMixer.inputNode);
_sourceNode.start(0, _startTime + _position);
_timeOffset = WebAudioApiMixer.audioContext.currentTime - _position;
} else {
_paused = false;
_sourceNode = WebAudioApiMixer.audioContext.createBufferSource();
_sourceNode.buffer = _webAudioApiSound._audioBuffer;
_sourceNode.loop = false;
_sourceNode.connectNode(_webAudioApiMixer.inputNode);
_sourceNode.start(0, _startTime + _position, _duration - _position);
_timeOffset = WebAudioApiMixer.audioContext.currentTime - _position;
_startCompleteTimer(_duration - _position);
}
}