减少 API 稀疏过滤的响应
如果 API 响应的数据太多,你可以通过稀疏过滤来缩小你要得到的数据。对于稀疏过滤,你有两个字段可以帮助你做到这一点:
- "include=",将描述哪些类别的 JSON 响应应被包括在内。你可以指定由逗号分隔的多个路径。
- "field[]=,"将描述该特定类别应包括哪些值。你可以有多个字段定义,为每个类别指定不同的值。
示例:您想读出某个 文件录制输出目的地当前是否正在录制。在这种情况下,我们感兴趣的是根类别 "数据 "中 "属性 "类别的 "实时状态 "值。这意味着我们需要指定包含类别路径为 "data.attributes"。属性 "类别包含多个值,但我们只想查看响应中的 "实时状态",这就是我们通过 "fields[attributes]=live-state "缩小范围的原因。
这就构成了下面的curl命令:(请确保用你自己的值来替换和的值!)
curl "http://192.168.0.107:8989/api/v1/documents//output-destinations/?include=data.attributes&fields[attributes]=live-state"
答复将看起来像这样:
{"data":{"attributes":{"live-state":"preview"}}}
文件
文档 "类型对应于mimoLive以".tvshow "文件写入磁盘的文档对象。
{
// Unique Identifier of the document
"id": String,
// Always "documents" (see the JSON-API documentation for more information on this field)
"type": "documents",
// See the JSON:API specification for more information on this field
"relationships": {
// The layer contained in the document
"layers": Relationship,
// The sources used by the document
"sources": Relationship,
// The output destinations used by this document
"output-destinations": Relationship
},
// The link to the resource itself (see the JSON:API specification for more information on this field)
"links": Object,
// This is probably the data you are after
"attributes": {
// The name of the document
"name": String,
// Metatdata of the document
"metadata": {
// Comments as entered in the show metadata panel in mimoLive
"comments": String,
// The height of the document in pixels
"height": Integer,
// The width of the document in pixels
"width": Integer,
// The author of the document as entered in the show metadata panel in mimoLive
"author": String,
// The title of the show as entered in the show metadata panel in mimoLive
"title": String,
// The proposed show length (timer) as entered in the show metadata panel inmimoLive (in seconds)
"duration": Integer,
// The framerate of the document in frames per second
"framerate": Float,
// The generic show name as entered in the show metadata panel in mimoLive
"show": String,
// The audio samplerate of the document in hz
"samplerate": Integer
},
// The live state of the document/show (see LiveState for possible values and their meaning)
"live-state": LiveState,
// If the show is currently live, the current length of the show in seconds
"duration": Integer,
// If the show is currently live, timestamp when the show went live (can be used together with "metadata.duration" and "duration" to compute a countdown)
"show-start": Integer
}
}
分层
图层 "类型表示在渲染管道中使用的图层,以生成mimoLive的视频输出。
{
// Unique identifier of the layer
"id": String,
// Always "layers" (see the JSON-API documentation for more information on this field)
"type": "layers",
// See the JSON:API specification for more information on this field
"relationships": {
// The document this layer is part of
"document": Relationship,
// All the layer variants for this layer
"variants": Relationship,
// The variant that is currently live (null otherwise)
"live-variant": Relationship,
// The variant that is active/selected for that layer
"active-variant": Relationship
},
// The link to the resource itself (see the JSON:API specification for more information on this field)
"links": Object,
// Attributes of the layer (this is probably the data you are after)
"attributes": {
// The composition identifier for the layer, this can be used to differentiate the various layer types
"composition-id": String,
// The live state of the layer (see LiveState for possible values and their meaning)
"live-state": LiveState,
// The name of the layer as displayed in the mimoLive layer stack
"name": String,
// The user-controlled volume of the layer, as seen in the layer stack
// where 0.0 means silence and 1.0 is full volume.
// If the layer has no volume control, the value is null.
"volume": Float | null,
// The inputs used for the layer (composition). The keys come directly from the underlying QuartzComposition. Check out the custom layer protocol for more information on the key names and their meaning. The layer reports the "input-values" from either "live-variant" or the "active-variant" if the layer is not live.
"input-values": Object,
// Description object for each of the keys returned in "input-values"
"input-descriptions": {
(String): {
// Whether the input is currently hidden in the mimoLive user interface
"hidden": Bool,
// The type of the input ("string", "number", "index", "bool", "color", "image", "structure")
"type": String,
// If applicable: The minimum value the input accepts
"value-min": Float,
// If applicable: The maximum value the input accepts
"value-max": Float,
// For dropdowns a list of names for the individual values
"value-list": Array,
// By which ammount a value should be increased or decreased
"value-step": Float,
// String that declares in which unit the value is (eg. "°C")
"value-unit": String,
// Label that is shown next to the input
"label": String,
// The index of the input (for sorting)
"index": Integer
}
},
// Outputs from the last render cycle that were returned from QuartzComposer, including the original keys
"output-values": Object,
// The index of the layer in the layer stack (zero relates to the top of the stack)
"index": Integer
}
}
*"volume" 属性已在 mimoLive 5.2 中添加。
变体
变体 "类型是一个图层配置实例的模型。大多数图层只有一个变体,但对于某些图层(如 Lower Thirds),通常会有多个具有不同文本内容的变体。事实上,图层主要是作为其当前活动变体的代理。
{
// Unique identifier of the variant
"id": String,
// Always "variants" (see the JSON-API documentation for more information on this field)
"type": "variants",
// See the JSON:API specification for more information on this field
"relationships": {
// The layer this variant belongs to
"layer": Relationship
},
// The link to the resource itself (see the JSON:API specification for more information on this field)
"links": Object,
// Attributes of the variant (this is probably the data you are after)
"attributes": {
// The live state of the variant (see LiveState for possible values and their meaning). If the layer is not live, the value will always be "off".
"live-state": LiveState,
// The name of the variant as displayed in the mimoLive layer stack
"name": String,
// The inputs used for the variant (composition). The keys come directly from the underlying QuartzComposition. Check out the custom layer protocol for more information on the key names and their meaning. The layer reports the "input-values" from either "live-variant" or the "active-variant" if the layer is not live.
"input-values": Object,
// Description object for each of the keys returned in "input-values"
"input-descriptions": {
(String): {
// Whether the input is currently hidden in the mimoLive user interface
"hidden": Bool,
// The type of the input ("string", "number", "index", "bool", "color", "image", "structure")
"type": String,
// If applicable: The minimum value the input accepts
"value-min": Float,
// If applicable: The maximum value the input accepts
"value-max": Float,
// For dropdowns a list of names for the individual values
"value-list": Array,
// By which ammount a value should be increased or decreased
"value-step": Float,
// String that declares in which unit the value is (eg. "°C")
"value-unit": String,
// Label that is shown next to the input
"label": String,
// The index of the input (for sorting)
"index": Integer
}
},
// Outputs from the last render cycle that were returned from QuartzComposer, including the original keys
"output-values": Object
}
}
资料来源
来源 "类型模拟在层、过滤器和其他来源中使用的来源,向mimoLive提供音频和视频输入。
{
// Unique identifier of the source
"id": String,
// Always "sources" (see the JSON-API documentation for more information
// on this field).
"type": "sources",
// See the JSON:API specification for more information on this field
"relationships": {
// The document this source is part of
"document": Relationship,
// The filters that process this source's video
"filters": Relationship
},
// The link to the resource itself (see the JSON:API specification for
// more information on this field).
"links": Object,
// Attributes of the variant (this is probably the data you are after)
"attributes": {
// The tally state of the source (see tally-state for possible values
// and their meaning)
"tally-state": TallyState,
// The name of the source as displayed in mimoLive
"name": String,
// Whether the source supplies video
"video": Bool,
// [optionally] If the associated video hardware is currently connected
// (Available since 5.5)
"video-device-connected": Bool,
// Whether the source supplies audio
"audio": Bool,
// [optionally] If the associated audio hardware is currently connected
// (Available since 5.5)
"audio-device-connected": Bool,
// Summary text of the source as displayed in mimoLive
"summary": String,
// The identifier of the composition if the source is based on a QuartzComposition
"composition-id": String,
// The gain that is applied to audio comming from this source, as
// controlled in the source settings view where 0.0 means silence,
// 1.0 is the default and 2.0 means doubled volume.
// Null if a source has no audio.
"gain": Float | null,
// The inputs used for the underlying composition (if it is a composition
// source). Check out the custom layer protocol for more information on
// the key names and their meaning.
"input-values": Object,
// Description object for each of the keys returned in "input-values"
"input-descriptions": {
(String): {
// Whether the input is currently hidden in the mimoLive window
"hidden": Bool,
// The type of the input ("string", "number", "index", "bool",
// "color", "image", "structure")
"type": String,
// If applicable: The minimum value the input accepts
"value-min": Float,
// If applicable: The maximum value the input accepts
"value-max": Float,
// For dropdowns a list of names for the individual values
"value-list": Array,
// By which ammount a value should be increased or decreased
"value-step": Float,
// String that declares in which unit the value is (eg. "°C")
"value-unit": String,
// Label that is shown next to the input
"label": String,
// The index of the input (for sorting)
"index": Integer
}
},
// Outputs from the last render cycle that were returned from
// QuartzComposer, including the original keys
"output-values": Object
}
}
*"增益 "属性已在mimoLive 5.2中添加。
过滤器
过滤器 "类型表示可以分配给视频源的过滤器,以便在用于图层之前处理视频。
{
// Unique identifier of the filter
"id": String,
// Always "filters" (see the JSON-API documentation for more information on this field)
"type": "filters",
// See the JSON:API specification for more information on this field.
"relationships": {
// The source that this filter belongs to
"source": Relationship
},
// The link to the resource itself (see the JSON:API specification for more information on this field)
"links": Object,
// Attributes of the variant (this is probably the data you are after)
"attributes": {
// The name of the filter as displayed in mimoLive
"name": String,
// The identifier of the filter's QuartzComposition
"composition-id": String,
// The inputs used for the underlying composition (if it is a composition source). Check out the custom layer protocol for more information on the key names and their meaning.
"input-values": Object,
// Description object for each of the keys returned in "input-values"
"input-descriptions": {
(String): {
// Whether the input is currently hidden in the mimoLive user interface
"hidden": Bool,
// The type of the input ("string", "number", "index", "bool", "color", "image", "structure")
"type": String,
// If applicable: The minimum value the input accepts
"value-min": Float,
// If applicable: The maximum value the input accepts
"value-max": Float,
// For dropdowns a list of names for the individual values
"value-list": Array,
// By which ammount a value should be increased or decreased
"value-step": Float,
// String that declares in which unit the value is (eg. "°C")
"value-unit": String,
// Label that is shown next to the input
"label": String,
// The index of the input (for sorting)
"index": Integer
}
},
// Outputs from the last render cycle that were returned from QuartzComposer, including the original keys
"output-values": Object
}
}
输出目的地
自 mimoLive 4.2 起可用
"输出-目的地 "类型可模拟 mimoLive 表演的不同输出目的地,包括录制、流媒体等。
{
// Unique identifier of the output destination
"id": String,
// Always "output-destinations" (see the JSON-API documentation for more information on this field)
"type": "output-destinations",
// See the JSON:API specification for more information on this field
"relationships": {
// The document that this output destination belongs to
"document": Relationship
},
// The link to the resource itself (see the JSON:API specification for more information on this field)
"links": Object,
// Attributes of the variant (this is probably the data you are after)
"attributes": {
// The name of the output destination as displayed in mimoLive
"title": String,
/*
The concrete type of output destination:
- "File Recording"
- "Audio Aux"
- "Live Streaming"
- "Virtual Camera"
- "Fullscreen"
- "Blackmagic Design"
- "NDI®" (including the "®")
*/
"type": String,
// A summary containing the most important settings
"summary": String,
// Whether the output destination is properly configured
"ready-to-go-live": Bool,
// Whether the output destination is set to start when the mimoLive show starts
"starts-with-show": Bool,
// Whether the output destination is set to stop when the mimoLive show ends
"stops-with-show": Bool,
// Individual settings depending on the "type" of output destination (see below for reference)
"settings": Object,
// The current live state of the output destination (see below for how to interpret the values)
"live-state": LiveState
}
}
个人设置
不同的输出目标类型有不同的设置。
以下是不同类型的 "设置 "对象。对于未列出的输出目标类型,字典将为空。
{
// Path to the folder that will contain the recording. Can be set to "null" to reset to initial value ("~/Movies').
"location": String,
// Filename that will be given to the recording. See below for placeholder values. Can be set to "null" to reset to initial value ("%document %year-%month-%day %hour-%minute-%second.%extension").
"filename": String
}
{
// Available since: mimoLive 5.5:
// Ofuscated URL of the streaming endpoint.
"rtmpurl": String,
// Ofuscated steaming key.
"streamingkey": String,
// Public broadcast URL.
"publicurl": String
}
即使 "rtmpurl "和 "streamingkey "值被混淆了,你仍然可以通过PATCH请求来设置这些值。
文件记录的 "文件名 "属性的占位值
占位符 | 解释 |
---|---|
1TP3文件 | 文件的名称,包括.tvshow扩展名(取决于用户系统设置) |
1TP2 捐赠 | 节目名称 |
%extension | mov,没有.前缀 |
%年 | 4位数字的年份,例如:2018年 |
1TP4月 | 2位数字的月份,例如01代表1月 |
y | 2位数的日子,例如:31 |
%hour | 2位数的小时(24小时制时钟),例如:15 |
%minute | 2位数的分钟,例如:45 |
%second | 2位数的秒,例如:50 |
图层组
自 mimoLive 4.8 起可用
"层集 "类型为用户可在 mimoLive 中创建和管理的层集模型。
{
// Unique identifier of the layer set
"id": String,
// Always "layer-sets" (see the JSON-API documentation for more information on this field)
"type": "layer-sets",
// See the JSON:API specification for more information on this field
"relationships": {
// The document that this layer set belongs to
"document": Relationship
},
// The link to the resource itself (see the JSON:API specification for more information on this field)
"links": Object,
"attributes": {
// The name of the layer set as displayed in mimoLive
"name": String,
// Wheter the layer stack currently matches the configuration represented by the layer set
"active": Bool
}
}
活着的状态
LiveState "类型表示一个文档、图层或变体可以处于的状态。可能的值是:
价值 | 解释 |
---|---|
关闭 | 层:该层是关闭的,不会被渲染。 |
文件:该节目没有运行。 | |
输出目的地:输出目的地无法上线,因为它没有被正确配置。 | |
生活 | 图层:该层是活的,将被渲染,在一个变体上,这意味着该层是活的,变体是活的。 |
文件:该节目目前正在进行。 | |
输出目的地:输出目的地处于活动状态,正在传输/记录数据。 | |
预览 | 图层:该层显示在预览栏中,并可能很快被切换为实时状态。 |
输出目的地:输出目的地已准备好上线,等待命令。 | |
关闭 | 层:该层目前是活的,但正处于关闭过程中(例如,一个流出的过渡)。 |
创业公司 | 输出目的地:输出目的地正在启动中(例如,连接到外部服务)。 |
帐单状态
一个 "TallyState "代表一个来源可能处于的状态。活动的程度是有顺序的,只有最高的使用才会被报告。可能的值(从低到高)是:
价值 | 解释 |
---|---|
关闭 | 该源目前没有被mimoLive使用 |
使用中 | 目前在mimoLive的某处使用该源码 |
效果 | 该源目前用于在过滤器预览中被渲染。 |
预览 | 目前在预览输出里面使用的是源码 |
节目 | 该源码目前在程序输出里面使用 |