How to check whether LiveStream (Audio Only) is up on Wowza or not?

痴心易碎 提交于 2019-12-11 00:06:53

问题


I am streaming from Wowza to Mobile (Android). I am using Vitamio streaming library. The actual flow is like, Wowza don't have live stream up, when my app hits the Wowza, but after a while Wowza gets live stream up. Now I again want to hit the Wowza to check whether live stream up or not.

All I want is, my app should hit the Wowza in every 5 sec to check the stream up or not.


回答1:


It sounds like you just need to query your Wowza server to see if your stream is active or not. If so, then you can use a Wowza REST API command to query Incoming Streams (you need at least version 4.2+).

For example, to query application "live" for all Incoming Streams, you can send the following command via HTTP:

curl -X GET --header 'Accept:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_

You would get a response similar to:

{"serverName":"_defaultServer_","incomingStreams":[{"sourceIp":"<hidden>","isPTZEnabled":false,"applicationInstance":"_definst_","name":"wowzademo.stream","isRecordingSet":false,"isStreamManagerStream":true,"isPublishedToVOD":false,"isConnected":true,"ptzPollingInterval":2000}],"outgoingStreams":[],"recorders":[],"streamGroups":[],"name":"_definst_"}

Which shows that I have an Incoming Stream called "wowzademo.stream" (among other things). You can also change your response to be xml instead of json, if you prefer.

Update

In response to your comment, I would add:

  1. make sure that you are on at least version 4.2+; I would actually recommend using version 4.3 since there were some REST API fixes on the latest version;

  2. If you are on version 4.3, then test with disabling authentication by setting <AuthenticationMethod> and <DocumentationServerAuthenticationMethod> to none under the Root/Server/RESTInterface container of the conf/Server.xml file;

  3. Make sure that you add the restUserHTTPHeaders property to have the value "Access-Control-Allow-Origin:*|Access-Control-Allow-Methods:‌​OPTIONS,GET,PUT,DELE‌​TE,POST|Access-Contr‌​ol-Allow-Headers:Con‌​tent-Type".

If the above still does not work for you, try enabling the debug properties by setting <DiagnosticURLEnable> to true, and adding <debugEnable> (set to true/Boolean type) property in the RESTInterface container. You can view the logs generated by checking the access logs in the logs/ directory.



来源:https://stackoverflow.com/questions/34273477/how-to-check-whether-livestream-audio-only-is-up-on-wowza-or-not

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!