如何使用 GetHLSStreamingSessionURL 从 kinesis 视频流获取 URL

发布于 2025-01-10 14:55:27 字数 855 浏览 0 评论 0原文

我正在尝试使用 getHLSStreamingSessionURL 获取 URL 以在 kinesis 视频流上查看我的视频。

在邮递员上,我创建了一个对“https://endpoint/getHLSStreamingSessionURL”的 POST 调用

在邮递员上,我收到 200 响应,但响应正文是:

{
    "Output": {
        "__type": "com.amazon.coral.service#UnknownOperationException"
    },
    "Version": "1.0"
}

我希望响应返回 HLS url。

这是我的请求正文:

{
   "ContainerFormat": "FRAGMENTED_MP4",
   "DiscontinuityMode": "ON_DISCONTINUITY",
   "DisplayFragmentTimestamp": "ALWAYS",
   "Expires": 300,
   "HLSFragmentSelector": { 
      "FragmentSelectorType": "PRODUCER_TIMESTAMP",
       "TimestampRange": { 
        "EndTimestamp": 1646055362163,
        "StartTimestamp": 1646055362143
      }
   },
   "PlaybackMode": "ON-DEMAND",
   "StreamName": "DEV_videoStreamTest"
}

任何人都可以建议我的 http 请求出了什么问题并解释这个响应到底意味着什么吗?

I am trying to get a URL to view my video on kinesis video streams with getHLSStreamingSessionURL.

On postman I have created a POST call to 'https://endpoint/getHLSStreamingSessionURL

On postman I get a 200 response but the response body is :

{
    "Output": {
        "__type": "com.amazon.coral.service#UnknownOperationException"
    },
    "Version": "1.0"
}

I expect the response to return a HLS url.

And here is my request body:

{
   "ContainerFormat": "FRAGMENTED_MP4",
   "DiscontinuityMode": "ON_DISCONTINUITY",
   "DisplayFragmentTimestamp": "ALWAYS",
   "Expires": 300,
   "HLSFragmentSelector": { 
      "FragmentSelectorType": "PRODUCER_TIMESTAMP",
       "TimestampRange": { 
        "EndTimestamp": 1646055362163,
        "StartTimestamp": 1646055362143
      }
   },
   "PlaybackMode": "ON-DEMAND",
   "StreamName": "DEV_videoStreamTest"
}

Can anyone suggest what is wrong with my http request and explain what exactly this response means?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浮生面具三千个 2025-01-17 14:55:27

我发现这有点复杂,但你需要打电话给
首先 GetDataEndpoint 以获得正确的 API 端点 URL调用 获取HLSStreamingSessionURL

AWS Github 上有一个很棒的完整示例,您可以使用它来尝试所有参数:
amazon-kinesis-video-streams-media-viewer

但简而言之,调用

https://kinesisvideo.<region>.amazonaws.com/getDataEndpoint

返回类似这样的内容:

{ "DataEndpoint": "https://b-1234xyz.kinesisvideo.us-west-2.amazonaws.com" }

然后调用 getHLSStreamingSessionURL 替换您的基本 url:

https://b-1234xyz.kinesisvideo.us-west-2.amazonaws.com/getHLSStreamingSessionURL

我正在使用 boto3,所以这是我的简化示例 Python:

import boto3

# Get the API URL
kinesis_client = boto3.client("kinesisvideo")
response = kinesis_client.get_data_endpoint(
    StreamName=stream_name,
    APIName="GET_HLS_STREAMING_SESSION_URL"
)
endpoint_url = response.get("DataEndpoint")

# Get the Stream URL
kinesis_client = boto3.client(
    "kinesis-video-archived-media",
    endpoint_url=endpoint_url
)
response = kinesis_client.get_hls_streaming_session_url(
    StreamName=stream_name,
    ...
)

I found this a bit convoluted, but you need to make a call to
GetDataEndpoint first in order to get the correct API endpoint url to make the call to GetHLSStreamingSessionURL.

There's a great full example on the AWS Github, and you can use that to try out all the parameters:
amazon-kinesis-video-streams-media-viewer

But in short, the call to

https://kinesisvideo.<region>.amazonaws.com/getDataEndpoint

returns something like this:

{ "DataEndpoint": "https://b-1234xyz.kinesisvideo.us-west-2.amazonaws.com" }

then you make the call to getHLSStreamingSessionURL replacing your base url:

https://b-1234xyz.kinesisvideo.us-west-2.amazonaws.com/getHLSStreamingSessionURL

I'm using boto3, so here's my simplified example in python:

import boto3

# Get the API URL
kinesis_client = boto3.client("kinesisvideo")
response = kinesis_client.get_data_endpoint(
    StreamName=stream_name,
    APIName="GET_HLS_STREAMING_SESSION_URL"
)
endpoint_url = response.get("DataEndpoint")

# Get the Stream URL
kinesis_client = boto3.client(
    "kinesis-video-archived-media",
    endpoint_url=endpoint_url
)
response = kinesis_client.get_hls_streaming_session_url(
    StreamName=stream_name,
    ...
)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文