# NativeMediaSession

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-media-video/trait-nativemediasession/

**trait** · [`ferroui-media-video`](/docs/0.5.0/api/ferroui-media-video/) · v0.5.0

```rust
trait NativeMediaSession
```

Narrow platform boundary. `poll` reports native facts, not requested intent.
Implementations must release native resources on Drop and keep returned frame
allocations immutable until the last lease/GPU completion releases them.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media.Video/player.rs#L109)

## Members

- [`has_pending_frame_work`](#function-has_pending_frame_work)
- [`state`](#function-state)
- [`play`](#function-play)
- [`pause`](#function-pause)
- [`stop`](#function-stop)
- [`seek`](#function-seek)
- [`set_audio`](#function-set_audio)
- [`supports_playback_rate`](#function-supports_playback_rate)
- [`set_playback_rate`](#function-set_playback_rate)
- [`supports_casting`](#function-supports_casting)
- [`cast`](#function-cast)
- [`tracks`](#function-tracks)
- [`select_track`](#function-select_track)
- [`caption_text`](#function-caption_text)
- [`take_frame`](#function-take_frame)

<a id="function-has_pending_frame_work"></a>

### has_pending_frame_work

```rust
fn has_pending_frame_work(self: &Self) -> bool
```

A producer/import is still pending, including a ready native image
waiting for bounded GPU storage. Presentation must keep polling even
while native playback is paused or ended; submission is not readiness.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media.Video/player.rs#L113)

<a id="function-state"></a>

### state

```rust
fn state(self: &Self) -> Result<MediaPlaybackSession, MediaError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media.Video/player.rs#L116)

<a id="function-play"></a>

### play

```rust
fn play(self: &Self) -> MediaFuture<()>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media.Video/player.rs#L117)

<a id="function-pause"></a>

### pause

```rust
fn pause(self: &Self) -> Result<(), MediaError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media.Video/player.rs#L118)

<a id="function-stop"></a>

### stop

```rust
fn stop(self: &Self) -> Result<(), MediaError>
```

Retires pending preview output while preserving source ownership. The
player separately resets seekable media and owns frame-zero publication.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media.Video/player.rs#L121)

<a id="function-seek"></a>

### seek

```rust
fn seek(self: &Self, position: Duration) -> MediaFuture<Duration>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media.Video/player.rs#L124)

<a id="function-set_audio"></a>

### set_audio

```rust
fn set_audio(self: &Self, volume: f64, muted: bool) -> Result<(), MediaError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media.Video/player.rs#L125)

<a id="function-supports_playback_rate"></a>

### supports_playback_rate

```rust
fn supports_playback_rate(self: &Self) -> bool
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media.Video/player.rs#L126)

<a id="function-set_playback_rate"></a>

### set_playback_rate

```rust
fn set_playback_rate(self: &Self, _rate: f64) -> Result<(), MediaError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media.Video/player.rs#L129)

<a id="function-supports_casting"></a>

### supports_casting

```rust
fn supports_casting(self: &Self) -> bool
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media.Video/player.rs#L135)

<a id="function-cast"></a>

### cast

```rust
fn cast(self: &Self) -> MediaFuture<()>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media.Video/player.rs#L138)

<a id="function-tracks"></a>

### tracks

```rust
fn tracks(self: &Self, _kind: MediaTrackKind) -> Vec<MediaTrack>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media.Video/player.rs#L146)

<a id="function-select_track"></a>

### select_track

```rust
fn select_track(self: &Self, _kind: MediaTrackKind, _id: Option<u32>) -> Result<(), MediaError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media.Video/player.rs#L149)

<a id="function-caption_text"></a>

### caption_text

```rust
fn caption_text(self: &Self) -> Option<String>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media.Video/player.rs#L155)

<a id="function-take_frame"></a>

### take_frame

```rust
fn take_frame(self: &Self) -> Result<Option<FrameLease>, MediaError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media.Video/player.rs#L158)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
