Skip to main content

fission_core/action/
video.rs

1use crate::{Action, ActionId};
2use fission_ir::WidgetNodeId;
3use lazy_static::lazy_static;
4use serde::{Deserialize, Serialize};
5
6#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
7pub struct VideoPlay {
8    pub target: WidgetNodeId,
9}
10
11impl Action for VideoPlay {
12    fn static_id() -> ActionId {
13        *VIDEO_PLAY_ID
14    }
15}
16
17lazy_static! {
18    pub static ref VIDEO_PLAY_ID: ActionId = ActionId::from_name("fission_core::VideoPlay");
19}
20
21#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
22pub struct VideoPause {
23    pub target: WidgetNodeId,
24}
25
26impl Action for VideoPause {
27    fn static_id() -> ActionId {
28        *VIDEO_PAUSE_ID
29    }
30}
31
32lazy_static! {
33    pub static ref VIDEO_PAUSE_ID: ActionId = ActionId::from_name("fission_core::VideoPause");
34}
35
36#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
37pub struct VideoStop {
38    pub target: WidgetNodeId,
39}
40
41impl Action for VideoStop {
42    fn static_id() -> ActionId {
43        *VIDEO_STOP_ID
44    }
45}
46
47lazy_static! {
48    pub static ref VIDEO_STOP_ID: ActionId = ActionId::from_name("fission_core::VideoStop");
49}
50
51#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
52pub struct VideoSeek {
53    pub target: WidgetNodeId,
54    pub position_ms: u64,
55}
56
57impl Action for VideoSeek {
58    fn static_id() -> ActionId {
59        *VIDEO_SEEK_ID
60    }
61}
62
63lazy_static! {
64    pub static ref VIDEO_SEEK_ID: ActionId = ActionId::from_name("fission_core::VideoSeek");
65}
66
67#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
68pub struct VideoSetRate {
69    pub target: WidgetNodeId,
70    pub rate: f32,
71}
72
73impl Action for VideoSetRate {
74    fn static_id() -> ActionId {
75        *VIDEO_SET_RATE_ID
76    }
77}
78
79lazy_static! {
80    pub static ref VIDEO_SET_RATE_ID: ActionId = ActionId::from_name("fission_core::VideoSetRate");
81}
82
83#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
84pub struct VideoSetVolume {
85    pub target: WidgetNodeId,
86    pub volume: f32,
87}
88
89impl Action for VideoSetVolume {
90    fn static_id() -> ActionId {
91        *VIDEO_SET_VOLUME_ID
92    }
93}
94
95lazy_static! {
96    pub static ref VIDEO_SET_VOLUME_ID: ActionId =
97        ActionId::from_name("fission_core::VideoSetVolume");
98}
99
100#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
101pub struct VideoSetMuted {
102    pub target: WidgetNodeId,
103    pub muted: bool,
104}
105
106impl Action for VideoSetMuted {
107    fn static_id() -> ActionId {
108        *VIDEO_SET_MUTED_ID
109    }
110}
111
112lazy_static! {
113    pub static ref VIDEO_SET_MUTED_ID: ActionId =
114        ActionId::from_name("fission_core::VideoSetMuted");
115}