pub struct AudioPlayer { /* private fields */ }Expand description
A player for one piece of audio.
Implementations§
Source§impl AudioPlayer
impl AudioPlayer
Sourcepub fn new(ident: impl Into<Ident>) -> Self
pub fn new(ident: impl Into<Ident>) -> Self
A player with no transport, which is a player that says so.
Sourcepub fn title(self, title: impl Into<SharedString>) -> Self
pub fn title(self, title: impl Into<SharedString>) -> Self
What is playing.
Sourcepub fn subtitle(self, subtitle: impl Into<SharedString>) -> Self
pub fn subtitle(self, subtitle: impl Into<SharedString>) -> Self
A second line under the title: a speaker, an artist, a source.
Sourcepub fn transport(self, transport: Rc<dyn MediaTransport>) -> Self
pub fn transport(self, transport: Rc<dyn MediaTransport>) -> Self
The player behind the controls.
Without one there is no playback on this machine, and this component says that rather than drawing controls that would do nothing.
Sourcepub fn elapsed(self, elapsed: impl Into<SharedString>) -> Self
pub fn elapsed(self, elapsed: impl Into<SharedString>) -> Self
How far in the audio is, in the host’s own words.
Sourcepub fn remaining(self, remaining: impl Into<SharedString>) -> Self
pub fn remaining(self, remaining: impl Into<SharedString>) -> Self
How much is left, in the host’s own words.
Sourcepub fn peaks(self, peaks: impl IntoIterator<Item = f32>) -> Self
pub fn peaks(self, peaks: impl IntoIterator<Item = f32>) -> Self
The peak amplitude of each slice of the audio, between zero and one, as somebody who read the samples measured it.
Supplying none draws no waveform. There is no decoder here, so an envelope this component invented would be a picture of nothing.
Sourcepub fn step_seconds(self, seconds: f32) -> Self
pub fn step_seconds(self, seconds: f32) -> Self
How far one arrow key jumps, in seconds.
Sourcepub fn speeds(self, speeds: impl IntoIterator<Item = f32>) -> Self
pub fn speeds(self, speeds: impl IntoIterator<Item = f32>) -> Self
The speeds the transport offers. Offering none leaves the control out.
pub fn on_event( self, handler: impl Fn(&MediaEvent, &mut Window, &mut App) + 'static, ) -> Self
Trait Implementations§
Source§impl Debug for AudioPlayer
impl Debug for AudioPlayer
Source§impl Disableable for AudioPlayer
impl Disableable for AudioPlayer
Source§impl IntoElement for AudioPlayer
impl IntoElement for AudioPlayer
Source§type Element = ViewElement<AudioPlayer>
type Element = ViewElement<AudioPlayer>
Source§fn into_element(self) -> Self::Element
fn into_element(self) -> Self::Element
Element.Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement.Source§impl RenderOnce for AudioPlayer
impl RenderOnce for AudioPlayer
Source§fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement
fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement
Render::render() method
which takes a mutable reference.Auto Trait Implementations§
impl !RefUnwindSafe for AudioPlayer
impl !Send for AudioPlayer
impl !Sync for AudioPlayer
impl !UnwindSafe for AudioPlayer
impl Freeze for AudioPlayer
impl Unpin for AudioPlayer
impl UnsafeUnpin for AudioPlayer
Blanket Implementations§
Source§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
Source§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<E> Flipping for Ewhere
E: IntoElement,
impl<E> Flipping for Ewhere
E: IntoElement,
Source§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
Source§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more