diff --git a/crates/bevy_audio/src/audio.rs b/crates/bevy_audio/src/audio.rs index 4384175705..a7c3a614ba 100644 --- a/crates/bevy_audio/src/audio.rs +++ b/crates/bevy_audio/src/audio.rs @@ -78,7 +78,7 @@ where pub fn play(&self, audio_source: Handle) -> Handle { let id = HandleId::random::(); let config = AudioToPlay { - repeat: false, + settings: PlaybackSettings::ONCE, sink_handle: id, source_handle: audio_source, }; @@ -86,13 +86,31 @@ where Handle::::weak(id) } - /// Play audio from a [`Handle`] to the audio source in a loop + /// Play audio from a [`Handle`] to the audio source with [`PlaybackSettings`] that + /// allows looping or changing volume from the start. /// - /// See [`Self::play`] on how to control playback. - pub fn play_in_loop(&self, audio_source: Handle) -> Handle { + /// ``` + /// # use bevy_ecs::system::Res; + /// # use bevy_asset::AssetServer; + /// # use bevy_audio::Audio; + /// # use bevy_audio::PlaybackSettings; + /// fn play_audio_system(asset_server: Res, audio: Res