WOWZA流引擎REST API不更新RTMP URL

时间:2016-09-19 12:09:21

标签: rest wowza

我正在尝试重新播放Live" RTMP"通过wowza流媒体流。我正在使用wowza REST API来实现此目的。我能够创建流文件,但不会在此文件中创建/更新RTMP URI目标。以下是详细步骤和获得的结果。 1.使用以下请求创建流文件

POST: `http://<server-ip>:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/<app-name>/streamfiles`

头:

  Accept :application/json 
     Content-Type: application/json

BODY

{
  "name": "test_stream",
  "uri": "rtmp://ingest-sgp-01.lb.nanocosmos.de:80/live/<stream-name>"
}

结果

{
  "success": true,
  "message": "",
  "data": null
}

当我使用Stream状态检查状态时,RTMP URL未在属性中创建。细节如下 GET:

`http://<server-ip>:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/<app-name>/streamfiles/test_stream/adv`

BODY
 {
      "enabled": false,
      "canRemove": true,
      "name": "uri",
      "valuhttp://<server-ip>:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/<app-name>/streamfiles/test_stream/adve": null,
      "defaultValue": null,
      "type": "String",
      "sectionName": "Common",
      "section": null,
      "documented": true
    }

我再次向服务器发送PUT请求,并提供以下详细信息。

http://<server-ip>:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/<app-name>/streamfiles/test_stream/adv

BODY

{
   "advancedSettings": [
{
"enabled": true,
"canRemove": true,
"name": "uri",
"value": "rtmp://ingest-sgp-01.lb.nanocosmos.de:80/live/Q0f8HNVJ1P",
"defaultValue": null,
"type": "String",
"sectionName": "Common",
"section": null,
"documented": true
},
{
"enabled": true,
"canRemove": true,
"name": "streamTimeout",
"value": "0",
"defaultValue": "12000",
"type": "Integer",
"sectionName": "Common",
"section": null,
"documented": true
},
{
"enabled": true,
"canRemove": true,
"name": "reconnectWaitTime",
"value": "0",
"defaultValue": "3000",
"type": "Integer",
"sectionName": "Common",
"section": null,
"documented": true
}
],
  "serverName": "_defaultServer_"
}

结果

{
  "success": true,
  "message": "",
  "data": null
}

但仍在streamfile细节中URI为null 结果

{
      "enabled": false,
      "canRemove": true,
      "name": "uri",
      "value": null,
      "defaultValue": null,
      "type": "String",these End points were hit with. swagger-ui tool provided by wowza, POST man tool with chrome, and nodej
      "sectionName": "Common",
      "section": null,
      "documented": true
    }

我无法解释为什么不通过不同的请求创建/更新此RTMP URL?这些REST端点被击中了。

  1. 由wowza提供的swagger-ui工具,
  2. 带有chrome的POST man工具,
  3. nodejs Request API。
  4. 所有结果都一样。 REST服务在wowza服务器的Server.xml文件中设置为不进行身份验证。

1 个答案:

答案 0 :(得分:0)

要通过REST API创建流文件,请尝试以下操作。

curl -X POST --header 'Accept:application/json; charset=utf-8' --header 'Content-type:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/streamfiles/test_stream -d'
{
   "restURI": "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/streamfiles",
   "streamFiles": [
      {
         "id": "connectAppName=live&appInstance=_definst_&mediaCasterType=rtp",
         "href": "http://localhohst:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/streamfiles/connectAppName=live&appInstance=_definst_&mediaCasterType=rtp"
      }
   ]
}'

要更新现有的流文件,您还需要在JSON正文中使用resturi参数,类似于以下内容:

curl -X PUT --header 'Accept:application/json; charset=utf-8' --header 'Content-type:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/streamfiles/test_stream/adv -d'
{
"restURI": "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/streamfiles/test_stream/adv",
"version": "1430601267443",
"advancedSettings": [
{
"enabled": true,
"canRemove": true,
"name": "uri",
"value": "rtmp://ingest-sgp-01.lb.nanocosmos.de:80/live/Q0f8HNVJ1P",
"defaultValue": null,
"type": "String",
"sectionName": "Common",
"section": null,
"documented": true
},
{
"enabled": true,
"canRemove": true,
"name": "streamTimeout",
"value": "0",
"defaultValue": "12000",
"type": "Integer",
"sectionName": "Common",
"section": null,
"documented": true
},
{
"enabled": true,
"canRemove": true,
"name": "reconnectWaitTime",
"value": "0",
"defaultValue": "3000",
"type": "Integer",
"sectionName": "Common",
"section": null,
"documented": true
}
]
}'