Search in sources :

Example 1 with AudioClipViewModel

use of org.odk.collect.audioclips.AudioClipViewModel in project collect by opendatakit.

the class AudioHelper method setAudio.

/**
 * @param button The control being used for playback
 * @param clip   The clip to be played
 * @return A {@link LiveData} value representing whether this clip is playing or not
 */
public LiveData<Boolean> setAudio(AudioButton button, Clip clip) {
    AudioClipViewModel viewModel = this.viewModel;
    LiveData<Boolean> isPlaying = viewModel.isPlaying(clip.getClipID());
    isPlaying.observe(lifecycleOwner, button::setPlaying);
    button.setListener(new AudioButtonListener(viewModel, clip.getURI(), clip.getClipID()));
    return isPlaying;
}
Also used : AudioClipViewModel(org.odk.collect.audioclips.AudioClipViewModel)

Aggregations

AudioClipViewModel (org.odk.collect.audioclips.AudioClipViewModel)1