pub struct Play { /* private fields */ }
Expand description
The command to tell playing information.
Following format is required:
Field | AMF Type | Value |
---|---|---|
Null | Nothing but an AMF’s type marker is in. | |
Stream Name | String | A name for subscribing a data from the server. |
Start Time | Number | Time offset of data subscribing. Note this can be several negative number (See Play Mode). |
§Play Mode
Value | Play Mode | Description |
---|---|---|
-2 | Both | Subscribes recorded data if its data isn’t on a livestream (default). |
-1 | Live | Subscribes only as livestream. |
0 (And above) | Recorded | Subscribes only as recorded data. |
Note the server can treat as some error if its data doesn’t exist as specified mode.
Implementations§
Source§impl Play
impl Play
Sourcepub fn new(
stream_name: AmfString,
start_time: Duration,
play_mode: PlayMode,
) -> Self
pub fn new( stream_name: AmfString, start_time: Duration, play_mode: PlayMode, ) -> Self
Constructs a Play command.
Sourcepub fn get_stream_name(&self) -> &AmfString
pub fn get_stream_name(&self) -> &AmfString
Gets the stream name. (e.g. filename)
Sourcepub fn get_start_time(&self) -> Duration
pub fn get_start_time(&self) -> Duration
Gets the start time.
Sourcepub fn get_play_mode(&self) -> PlayMode
pub fn get_play_mode(&self) -> PlayMode
Gets the play mode.
Trait Implementations§
Source§impl ChunkData for Play
impl ChunkData for Play
const CHANNEL: Channel = Channel::Source
const MESSAGE_TYPE: MessageType = MessageType::Command
Source§impl Decoder<Play> for ByteBuffer
impl Decoder<Play> for ByteBuffer
Source§fn decode(&mut self) -> IOResult<Play>
fn decode(&mut self) -> IOResult<Play>
Decodes bytes into a Play command.
§Errors
When some field misses.
When some value is inconsistent with its marker.
When some value is invalid for UTF-8 string.
§Examples
use sheave_core::{
ByteBuffer,
Decoder,
Encoder,
messages::{
Play,
amf::v0::{
AmfString,
Null,
Number
}
}
};
let mut buffer = ByteBuffer::default();
buffer.encode(&Null);
buffer.encode(&AmfString::default());
buffer.encode(&Number::new(-2000f64));
assert!(Decoder::<Play>::decode(&mut buffer).is_ok());
let mut buffer = ByteBuffer::default();
assert!(Decoder::<Play>::decode(&mut buffer).is_err())
Source§impl Encoder<Play> for ByteBuffer
impl Encoder<Play> for ByteBuffer
impl Command for Play
impl StructuralPartialEq for Play
Auto Trait Implementations§
impl Freeze for Play
impl RefUnwindSafe for Play
impl Send for Play
impl Sync for Play
impl Unpin for Play
impl UnwindSafe for Play
Blanket Implementations§
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
Mutably borrows from an owned value. Read more