Results 1 to 6 of 6

Thread: Add audio status to HTTP Provider

  1. #1
    Join Date
    Jul 2014
    Posts
    5

    Default Add audio status to HTTP Provider

    I have a custom HTTP provider that is provides more detailed info (better connection counts and whether a publisher is connected or not) and I would like to add a status of whether the stream contains audio or not. Is getAudioSize() on IMediaStream the right method to use? Will it be 0 if there is no audio stream provided or should I be using some other property?

    Thanks

  2. #2
    Join Date
    May 2013
    Posts
    681

    Default

    You might look at IMediaStream.isReceiveAudio and/or utilize getPlayPackets to examine if audio exists.

  3. #3
    Join Date
    Jul 2014
    Posts
    5

    Default

    Thanks Matt, I looked at isReceiveAudio and it says "Is client currently receiving audio. Controlled by client side call receiveAudio.". Would that for sure work? I'm not sure what the client side call receiveAudio is in this context.

  4. #4
    Join Date
    May 2013
    Posts
    681

    Default

    Hello sethtvn

    Upon further review, it seems that isReceiveAudio may not work as I originally thought. After some testing, I found success upon obtaining a reference to AMFPacket and checking for audio (packet.isAudio()). The IMediaStream.getAudioSize function will return 0 if there is no audio but you can only rely on that after data from the stream is actually hitting Wowza. You might check this after stream.getPlayPackets() is no longer empty (in a thread). Alternatively you might use the IMediaStreamActionNotify3 interface and if you receive onCodecInfoAudio event it will indicate audio is available.

    Thanks,

    Matt
    Last edited by matt_y; 07-03-2014 at 05:40 AM.

  5. #5
    Join Date
    Jul 2014
    Posts
    5

    Default

    " The IMediaStream.getAudioSize function will return 0 if there is no audio but you can only rely on that after data from the stream is actually hitting Wowza."

    So in the case of live streams, checking this would work?

    What I'm trying to do add a status to my HTTP provider xml output that shows wether a live stream contains audio or not and then in my web application display a status to the end user so they know before clicking on stream whether it has audio or not. The live streams are all published by independent users and they often stream without audio, sometimes they will disable and re-enable audio in the same day while streaming (when they want some privacy, etc).

  6. #6
    Join Date
    Dec 2007
    Posts
    22,013

    Default

    What you could do is use IMediaStreamActionNotify3.onCodecInfoAudio() and WMSProperties.

    onCodecInfoAudio() won't run if there is not audio.

    public void onCodecInfoAudio(IMediaStream stream,
    				MediaCodecInfoAudio codecInfoAudio) {
    			System.out.println("onCodecInfoAudio[" + stream.getContextStr() + " Audio Codec" + codecInfoAudio.toCodecsStr() + "]: ");
    
    // Set Property on the stream.
    stream.getProperties().setProperty("audioCodec", codecInfoAudio.toCodecsStr() );
    
    		}
    Then in your HTTPProvider, drill down to the stream and see if the property exists:

    String audioCodec = stream.getProperties().getPropertyStr("audioCodec");
    Richard

Similar Threads

  1. Use HTTPS for an HTTP Provider?
    By guilleart in forum Server-side Modules and Code Samples Discussion
    Replies: 1
    Last Post: 11-28-2013, 12:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •