(audio_bytes: Vec<u8>, content_type: String, cx: &mut Context<Self>)
| 47 | } |
| 48 | |
| 49 | impl AudioPlayer { |
| 50 | pub fn new(audio_bytes: Bytes, content_type: String, cx: &mut Context<Self>) -> Self { |
| 51 | let duration = Self::probe_duration(&audio_bytes, &content_type); |
| 52 | |
| 53 | Self { |
| 54 | audio_bytes, |
| 55 | content_type, |
| 56 | playback_state: PlaybackState::Stopped, |
| 57 | volume: 0.8, |
| 58 | muted: false, |
| 59 | current_position: Duration::ZERO, |
| 60 | total_duration: duration, |
| 61 | focus_handle: cx.focus_handle(), |
| 62 | backend: None, |
| 63 | progress_bounds: Bounds::default(), |
| 64 | error_message: None, |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | fn probe_duration(bytes: &Bytes, _content_type: &str) -> Option<Duration> { |
nothing calls this directly
no test coverage detected