协议
ElementarySource
在 fuchsia.media.playback/source_manager.fidl 中定义
Source 变体,用于直接向播放器提供基本流。
AddBinding
向此 ElementarySource 添加新绑定。通过使用此方法,即使在通过调用 SourceManager.SetSource 消耗了一个通道后,客户端也可以获得一个额外的通道,以便与此 ElementarySource 进行通信。
请求
| 名称 | 类型 |
|---|---|
source_request |
server_end:ElementarySource
|
AddStream
添加基本流。可以通过关闭 SimpleStreamSink 来移除基本流。ticks_per_second_numerator 和 ticks_per_second_denominator 表示将用于 Streampacket 时间戳值的单位。例如,对于纳秒单位,ticks_per_second_numerator 应为 1000000000,ticks_per_second_denominator 应为 1。如需对 48k 音频使用帧单位,ticks_per_second_numerator 应为 48000,ticks_per_second_denominator 应为 1。
请求
| 名称 | 类型 |
|---|---|
type |
fuchsia.media/StreamType
|
ticks_per_second_numerator |
uint32
|
ticks_per_second_denominator |
uint32
|
sink_request |
server_end:fuchsia.media/SimpleStreamSink
|
OnStatusChanged
响应
| 名称 | 类型 |
|---|---|
source_status |
SourceStatus
|
玩家
在 fuchsia.media.playback/player.fidl 中定义
播放媒体内容。
AddBinding
为此播放器添加新的绑定。
请求
| 名称 | 类型 |
|---|---|
player_request |
server_end:Player
|
BindGainControl
绑定到此播放器的增益控件。
请求
| 名称 | 类型 |
|---|---|
gain_control_request |
server_end:fuchsia.media.audio/GainControl
|
CancelSourceTransition
取消待处理的转换,返回来源。如果没有待处理的转换,则请求通道会关闭。
请求
| 名称 | 类型 |
|---|---|
returned_source_request |
server_end:Source
|
CreateElementarySource
创建一个来源,使客户端能够向播放器提供独立的基本流。duration_ns、can_pause、can_seek 和 metadata 都包含在 SourceStatus 中,当播放器使用 ElementarySource 时,也会包含在 PlayerStatus 中。can_pause 和 can_seek(如果为 false)会限制播放器的功能。
请求
| 名称 | 类型 |
|---|---|
duration_ns |
zx/Duration
|
can_pause |
bool
|
can_seek |
bool
|
metadata |
fuchsia.media/Metadata?
|
source_request |
server_end:ElementarySource
|
CreateFileSource
创建从文件读取数据的来源。
请求
| 名称 | 类型 |
|---|---|
file_channel |
handle<channel>
|
source_request |
server_end:Source
|
CreateReaderSource
创建从 SeekingReader 读取数据的来源。
请求
| 名称 | 类型 |
|---|---|
seeking_reader |
client_end:SeekingReader
|
source_request |
server_end:Source
|
CreateView
创建视频观看。
请求
| 名称 | 类型 |
|---|---|
view_token |
fuchsia.ui.views/ViewToken
|
OnStatusChanged
在绑定后立即提供当前状态,并在之后状态发生变化时提供。
响应
| 名称 | 类型 |
|---|---|
player_status |
PlayerStatus
|
暂停
暂停播放。
请求
<EMPTY>
播放
开始播放。
请求
<EMPTY>
进度
跳转到指定位置(以纳秒为单位)。
请求
| 名称 | 类型 |
|---|---|
position |
int64
|
SetFileSource
设置要从中读取数据的文件通道。
请求
| 名称 | 类型 |
|---|---|
file_channel |
handle<channel>
|
SetFileSourceWithOptions
设置要从中读取数据的文件通道。
请求
| 名称 | 类型 |
|---|---|
file_channel |
handle<channel>
|
options |
PlayerOptions
|
SetPlaybackRate
设置播放器播放时要使用的速率。rate 必须为正值。PlayerStatus 的 timeline_function 字段表示玩家玩游戏时的实际速率。
请求
| 名称 | 类型 |
|---|---|
playback_rate |
float32
|
SetSource
设置此播放器要使用的来源。如果来源为 null,播放器会进入空闲状态。
请求
| 名称 | 类型 |
|---|---|
source |
client_end:Source?
|
TransitionToSource
当当前来源的播放达到 transition_pts 时,过渡到指定来源。新来源在 start_pts 处开始播放。如果已有待处理的转换,系统会将其舍弃,改为使用新的转换。
请求
| 名称 | 类型 |
|---|---|
source |
client_end:Source
|
transition_pts |
int64
|
start_pts |
int64
|
SeekingReader
在 fuchsia.media.playback/seeking_reader.fidl 中定义
描述
请求
<EMPTY>
响应
| 名称 | 类型 |
|---|---|
status |
zx/Result
|
size |
uint64
|
can_seek |
bool
|
ReadAt
请求
| 名称 | 类型 |
|---|---|
position |
uint64
|
响应
| 名称 | 类型 |
|---|---|
status |
zx/Result
|
socket |
handle<socket>?
|
来源
在 fuchsia.media.playback/source_manager.fidl 中定义
播放器可能使用的内容来源。
OnStatusChanged
响应
| 名称 | 类型 |
|---|---|
source_status |
SourceStatus
|
SourceManager
在 fuchsia.media.playback/source_manager.fidl 中定义
代表玩家管理来源。
CancelSourceTransition
取消待处理的转换,返回来源。如果没有待处理的转换,则请求通道会关闭。
请求
| 名称 | 类型 |
|---|---|
returned_source_request |
server_end:Source
|
CreateElementarySource
创建一个来源,使客户端能够向播放器提供独立的基本流。duration_ns、can_pause、can_seek 和 metadata 都包含在 SourceStatus 中,当播放器使用 ElementarySource 时,也会包含在 PlayerStatus 中。can_pause 和 can_seek(如果为 false)会限制播放器的功能。
请求
| 名称 | 类型 |
|---|---|
duration_ns |
zx/Duration
|
can_pause |
bool
|
can_seek |
bool
|
metadata |
fuchsia.media/Metadata?
|
source_request |
server_end:ElementarySource
|
CreateFileSource
创建从文件读取数据的来源。
请求
| 名称 | 类型 |
|---|---|
file_channel |
handle<channel>
|
source_request |
server_end:Source
|
CreateReaderSource
创建从 SeekingReader 读取数据的来源。
请求
| 名称 | 类型 |
|---|---|
seeking_reader |
client_end:SeekingReader
|
source_request |
server_end:Source
|
SetSource
设置此播放器要使用的来源。如果来源为 null,播放器会进入空闲状态。
请求
| 名称 | 类型 |
|---|---|
source |
client_end:Source?
|
TransitionToSource
当当前来源的播放达到 transition_pts 时,过渡到指定来源。新来源在 start_pts 处开始播放。如果已有待处理的转换,系统会将其舍弃,改为使用新的转换。
请求
| 名称 | 类型 |
|---|---|
source |
client_end:Source
|
transition_pts |
int64
|
start_pts |
int64
|
STRUCTS
PlayerStatus
在 fuchsia.media.playback/player.fidl 中定义
玩家状态信息。
| 字段 | 类型 | 说明 | 默认 |
|---|---|---|---|
duration |
zx/Duration
|
内容的时长。 |
无默认应用 |
can_pause |
bool
|
播放器是否可以暂停。 |
无默认应用 |
can_seek |
bool
|
播放器是否可以跳转。 |
无默认应用 |
has_audio |
bool
|
来源是否包含音频串流。 |
无默认应用 |
has_video |
bool
|
来源是否包含视频流。 |
无默认应用 |
ready |
bool
|
指明播放器是否已准备好播放。调用 |
无默认应用 |
metadata |
fuchsia.media/Metadata?
|
无默认应用 | |
problem |
Problem?
|
表示存在妨碍预期操作的问题。 |
无默认应用 |
audio_connected |
bool
|
指示当前是否连接了音频串流以进行渲染。
如果 |
无默认应用 |
video_connected |
bool
|
指明当前是否已连接视频流以进行渲染。
如果 |
无默认应用 |
video_size |
fuchsia.math/Size?
|
当前正在制作的视频的大小。如果视频大小目前未知,则此值为 null。 |
无默认应用 |
pixel_aspect_ratio |
fuchsia.math/Size?
|
视频像素的相对尺寸。如果像素宽高比目前未知,则此值为 null。 |
无默认应用 |
timeline_function |
fuchsia.media/TimelineFunction?
|
将本地时间转换为呈现时间的函数。如果时间轴函数当前未定义,则此值将为 null。 |
无默认应用 |
end_of_stream |
bool
|
指示所有数据流的呈现是否已到达数据流末尾。 |
无默认应用 |
问题
在 fuchsia.media.playback/problem.fidl 中定义
对导致无法按预期运行的问题进行建模。
Problem 通常作为组件状态的一部分显示,可能作为可选字段。没有 Problem 表示没有任何因素会阻止预期操作。当问题暴露时,客户端可以自动采取行动或显示相关界面。如果问题可以通过某种操作解决,客户端可能会自动执行该操作,或以某种方式让用户参与解决。在任一情况下,当导致问题暴露的问题得到解决后,问题就会消失。根据设计,没有常规方法可以忽略问题。
| 字段 | 类型 | 说明 | 默认 |
|---|---|---|---|
type |
string
|
问题类型。这是一个用于扩展的字符串。 |
无默认应用 |
details |
string?
|
取决于类型的详细信息。 |
无默认应用 |
SourceStatus
在 fuchsia.media.playback/source_manager.fidl 中定义
来源状态信息。
| 字段 | 类型 | 说明 | 默认 |
|---|---|---|---|
duration |
zx/Duration
|
内容的时长。 |
无默认应用 |
can_pause |
bool
|
来源是否可以暂停。 |
无默认应用 |
can_seek |
bool
|
来源是否可跳转。 |
无默认应用 |
has_audio |
bool
|
来源是否包含音频串流。 |
无默认应用 |
has_video |
bool
|
来源是否包含视频流。 |
无默认应用 |
ready |
bool
|
指明来源是否已准备就绪。值为 true 表示内容已通过探测,并且没有已知问题。 |
无默认应用 |
metadata |
fuchsia.media/Metadata?
|
描述媒体。 |
无默认应用 |
problem |
Problem?
|
表示存在妨碍预期操作的问题。null 值表示来源按预期运行。 |
无默认应用 |
TABLES
PlayerOptions
在 fuchsia.media.playback/player.fidl 中定义
SetFileSourceWithOptions 中使用的选项。
| 序数 | 字段 | 类型 | 说明 |
|---|---|---|---|
1 |
silent |
bool
|
如果设置为 true,则会禁止音频渲染。默认值为 false。 |
常量
| 名称 | 值 | 类型 | 说明 |
|---|---|---|---|
| PROBLEM_ASSET_NOT_FOUND | fuchsia.media.playback.AssetNotFound |
String |
|
| PROBLEM_AUDIO_ENCODING_NOT_SUPPORTED | fuchsia.media.playback.AudioEncodingNotSupported |
String |
|
| PROBLEM_CONNECTION_FAILED | fuchsia.media.playback.ConnectionFailed |
String |
|
| PROBLEM_CONTAINER_NOT_SUPPORTED | fuchsia.media.playback.ContainerNotSupported |
String |
|
| PROBLEM_INTERNAL | fuchsia.media.playback.Internal |
String |
|
| PROBLEM_VIDEO_ENCODING_NOT_SUPPORTED | fuchsia.media.playback.VideoEncodingNotSupported |
String |
|
| UNKNOWN_SIZE |
18446744073709551615
|
uint64 |
|