pub struct VideoRef(/* private fields */);Implementations§
Source§impl VideoRef
impl VideoRef
pub fn has_widget(&self, widget: &WidgetRef) -> VideoRef
pub fn borrow(&self) -> Option<Ref<'_, Video>>
pub fn borrow_mut(&self) -> Option<RefMut<'_, Video>>
pub fn borrow_if_eq(&self, widget: &WidgetRef) -> Option<Ref<'_, Video>>
pub fn borrow_mut_if_eq(&self, widget: &WidgetRef) -> Option<RefMut<'_, Video>>
Source§impl VideoRef
impl VideoRef
Sourcepub fn prepare_playback(&self, cx: &mut Cx)
pub fn prepare_playback(&self, cx: &mut Cx)
Prepares the video for playback. Does not start playback or update the video texture.
Once playback is prepared, [begin_playback] can be called to start the actual playback.
Alternatively, [begin_playback] (which uses [prepare_playback]) can be called if you want to start playback as soon as it’s prepared.
Sourcepub fn begin_playback(&self, cx: &mut Cx)
pub fn begin_playback(&self, cx: &mut Cx)
Starts the video playback. Calls prepare_playback(cx) if the video not already prepared.
Sourcepub fn pause_playback(&self, cx: &mut Cx)
pub fn pause_playback(&self, cx: &mut Cx)
Pauses the video playback. Ignores if the video is not currently playing.
Sourcepub fn resume_playback(&self, cx: &mut Cx)
pub fn resume_playback(&self, cx: &mut Cx)
Pauses the video playback. Ignores if the video is already playing.
Sourcepub fn mute_playback(&self, cx: &mut Cx)
pub fn mute_playback(&self, cx: &mut Cx)
Mutes the video playback. Ignores if the video is not currently playing or already muted.
Sourcepub fn unmute_playback(&self, cx: &mut Cx)
pub fn unmute_playback(&self, cx: &mut Cx)
Unmutes the video playback. Ignores if the video is not currently muted or not playing.
Sourcepub fn stop_and_cleanup_resources(&self, cx: &mut Cx)
pub fn stop_and_cleanup_resources(&self, cx: &mut Cx)
Stops playback and performs cleanup of all resources related to playback, including data source, decoding threads, object references, etc.
In order to play the video again you must either call [prepare_playback] or [begin_playback].
Sourcepub fn set_source(&self, source: VideoDataSource)
pub fn set_source(&self, source: VideoDataSource)
Updates the source of the video data. Currently it only proceeds if the video is in Unprepared state.
Sourcepub fn should_dispatch_texture_updates(&self, should_dispatch: bool)
pub fn should_dispatch_texture_updates(&self, should_dispatch: bool)
Determines if this video instance should dispatch VideoAction::TextureUpdated actions on each texture update.
This is disbaled by default because it can be quite nosiy when debugging actions.
pub fn set_thumbnail_texture(&self, cx: &mut Cx, texture: Option<Texture>)
pub fn is_unprepared(&self) -> bool
pub fn is_preparing(&self) -> bool
pub fn is_prepared(&self) -> bool
pub fn is_playing(&self) -> bool
pub fn is_paused(&self) -> bool
pub fn has_completed(&self) -> bool
pub fn is_cleaning_up(&self) -> bool
pub fn is_muted(&self) -> bool
Methods from Deref<Target = WidgetRef>§
pub fn is_empty(&self) -> bool
Sourcepub fn handle_event_with(
&self,
cx: &mut Cx,
event: &Event,
scope: &mut Scope<'_, '_>,
sweep_area: Area,
)
pub fn handle_event_with( &self, cx: &mut Cx, event: &Event, scope: &mut Scope<'_, '_>, sweep_area: Area, )
§handle event with a sweep area
this is used for the sweep event, this fn can help to pass the event into popup,
the widget should implement the handle_event_with fn in impl Widget for $Widget
§Example
impl Widget for Button {
fn handle_event_with(&mut self, cx: &mut Cx, event: &Event, scope: &mut Scope, sweep_area: Area) {
let uid = self.widget_uid();
if self.animator_handle_event(cx, event).must_redraw() {
self.draw_button.redraw(cx);
}
match event.hits_with_options(cx, self.draw_button.area(), HitOptions::new().with_sweep_area(sweep_area) ) {
Hit::FingerDown(f_down) => {
if self.grab_key_focus {
cx.set_key_focus(self.sweep_area);
}
cx.widget_action(uid, &scope.path, GButtonEvent::Pressed(f_down.modifiers));
self.animator_play(cx, id!(hover.pressed));
}
_ =>()
}
}§Details
See Flexible Popup
pub fn handle_event( &self, cx: &mut Cx, event: &Event, scope: &mut Scope<'_, '_>, )
Sourcepub fn widget_uid(&self) -> WidgetUid
pub fn widget_uid(&self) -> WidgetUid
Returns the unique ID (UID) of this widget.
Returns WidgetUid(0) if the widget is currently borrowed or is empty.