Aliyun.Oss.LiveChannel.put
You're seeing just the function
put
, go back to Aliyun.Oss.LiveChannel module for more information.
Link to this function
put(bucket, channel_name, config)
Specs
put(String.t(), String.t(), map() | String.t()) :: {:error, error()} | {:ok, Aliyun.Oss.Client.Response.t()}
通过RTMP协议上传音视频数据前,必须先调用该接口创建一个LiveChannel。调用PutLiveChannel接口会返回RTMP推流地址,以及对应的播放地址。
Examples
iex> config_json = %{
"LiveChannelConfiguration" => %{
"Description" => nil,
"Status" => "enabled",
"Target" => %{"FragCount" => "3", "FragDuration" => "2", "Type" => "HLS"}
}
}
iex> Aliyun.Oss.LiveChannel.put("some-bucket", "channe-name", config_json)
{:ok, %Aliyun.Oss.Client.Response{
data: %{
"CreateLiveChannelResult" => %{
"PlayUrls" => %{
"Url" => "http://some-bucket.oss-cn-shenzhen.aliyuncs.com/channel-name/playlist.m3u8"
},
"PublishUrls" => %{
"Url" => "rtmp://some-bucket.oss-cn-shenzhen.aliyuncs.com/live/channel-name"
}
}
},
headers: [
{"Server", "AliyunOSS"},
{"Date", "Wed, 05 Dec 2018 02:34:57 GMT"},
...
]
}
}
iex> config_xml = ~S[
<?xml version="1.0" encoding="UTF-8"?>
<LiveChannelConfiguration>
<Description></Description>
<Status>enabled</Status>
<Target>
<FragCount>3</FragCount>
<FragDuration>2</FragDuration>
<Type>HLS</Type>
</Target>
</LiveChannelConfiguration>
]
iex> Aliyun.Oss.LiveChannel.put("some-bucket", "channe-name", config_xml)
{:ok, %Aliyun.Oss.Client.Response{
data: %{
"CreateLiveChannelResult" => %{
"PlayUrls" => %{
"Url" => "http://some-bucket.oss-cn-shenzhen.aliyuncs.com/channel-name/playlist.m3u8"
},
"PublishUrls" => %{
"Url" => "rtmp://some-bucket.oss-cn-shenzhen.aliyuncs.com/live/channel-name"
}
}
},
headers: [
{"Server", "AliyunOSS"},
{"Date", "Wed, 05 Dec 2018 02:34:57 GMT"},
...
]
}
}