Results 1 to 7 of 7

Thread: Ingest Shoutcast without using .stream files

  1. #1

    Default Ingest Shoutcast without using .stream files

    Hi,

    We have written a plugin that uses IMediaStreamNameAliasProvider2. Now we also have to ingest audio stream from a shoutcast source from the same app (as the one in which we have to use the plugin)

    To use shoutcast ingest, we have to create a .stream file and start it using StartupStreams.xml. This is causing conflict with the plugins use of IMediaStreamNameAliasProvider2. While we can't change the plugin logic, is it possible to do the shoutcast ingest using anything other than .stream file? I read on the forum that alias stream map file can be used. But I am not sure how to use this and if using it will remove the conflict with the plugin.

    Please help.

    Thanks in advance
    Nitin

  2. #2

    Default

    Hi

    Please let us know how to resolve this. We are on the verge of signing up a good customer. But this is the only problem whose solution we have to show to him before formal signing up. Any pointers would be great.

    Thanks
    Nitin

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

    Default

    Nitin,

    You can use IMediaStreamNameAliasProvider2 and simple alias names with shoutcast streams. And you can use the alias in the StartUpStreams.xml to start the streams with MediaCaster type "shoutcast". Use the IMediaStreamNameAliasProvider2.resolveStreamAlias() for streams you will start using StartUpStreams.xml

    Richard

  4. #4

    Default

    Hi Richard,

    Many thanks for the quick reply. I am afraid I couldn't understand exactly what you said. I need some clarification.

    We have a shoutcast stream:

    http://54.123.23.78/sim.mp3 - We have to ingest this in to wowza. I am creating a stream file right now called radiostation.stream and configuring it in StartupStreams.xml in the following way:

    <StartupStream>
    <Application>live/_definst_</Application>
    <MediaCasterType>shoutcast</MediaCasterType>
    <StreamName>radiostation.stream</StreamName>
    </StartupStream>
    For the same app, I have included a plugin in Application.xml. In the plugin, I use the code as follows:

    public class AliasMap extends ModuleBase implements IMediaStreamNameAliasProvider2 {
    public void onAppStart(IApplicationInstance appInstance) {
    appInstance.setStreamNameAliasProvider(this);
    }

    public void onAppStop(IApplicationInstance appInstance) {
    }

    @Override
    public String resolvePlayAlias(IApplicationInstance appInstance, String name_with_token,
    IClient client) {
    }

    @Override
    public String resolvePlayAlias(IApplicationInstance appInstance, String arg1, IHTTPStreamerSession httpSession) {
    StreamName = findbestStream(httpSession);
    return StreamName;
    }

    @Override
    public String resolvePlayAlias(IApplicationInstance appInstance, String arg1, RTPSession rtpSession) {
    StreamName = findbestStream(rtpSession);
    return StreamName;
    }

    @Override
    public String resolvePlayAlias(IApplicationInstance arg0, String arg1, ILiveStreamPacketizer arg2){
    return arg1;
    }

    @Override
    public String resolveStreamAlias(IApplicationInstance arg0, String arg1, IMediaCaster arg2) {
    return arg1;
    }

    @Override
    public String resolvePlayAlias(IApplicationInstance arg0, String arg1) {
    return arg1;
    }

    @Override
    public String resolveStreamAlias(IApplicationInstance arg0, String arg1) {
    return arg1;
    }
    }
    According to your reply, can you please point out to me, where the change is required in the above code & the StartupStream.xml?

    Thanks a lot
    Nitin

  5. #5

    Default

    Hi Nitin,

    When using the IMediaStreamNameAliasProvider2 interface, all requests for a steam name will first be passed to one of the resolvePlayAlias methods and then if the request is also for a mediaCaster stream then it will then be passed to one of the resolveStreamAlias methods. There are different methods for each player type.

    This is also true when you start streams using StartupStreams.xml. In this case, the following happens:

    1. The Stream Name specified in the StartupStream is passed to the resolvePlayAlias(IApplicationInstance appInstance, String name) method. This should at least return the same name.
      public String resolvePlayAlias(IApplicationInstance appInstance, String name)
      {
          return name;
      }
      So if you use the following in your StartUpStream,
      <StartupStream>
          <Application>live/_definst_</Application>
          <MediaCasterType>shoutcast</MediaCasterType>
          <StreamName>myStream</StreamName>
      </StartupStream>
      then `myStream` will be passed into the resolvePlayAlias method and you will return the same value. If you return a different value then you should expect to receive that different value in the resolveStreamAlias methods below.
    2. The name returned from the resolvePlayAlias method is then passed to the resolveStreamAlias methods. In these methods, you should return the actual shoutcast url.
      public String resolveStreamAlias(IApplicationInstance appInstance, String name)
      {
          if (name.equals("myStream")
          {
              return "http://example.com:8000/"
          }
          else
          {
              return name;
          }
      }
      
      public String resolveStreamAlias(IApplicationInstance appInstance, String name, IMediaCaster mediaCaster)
      {
          if (name.equals("myStream")
          {
              return "http://example.com:8000/"
          }
          else
          {
              return name;
          }
      }
    3. The value returned from the resolveStreamAlias methods is what will be used to start the mediaCaster


    All of your other resolvePlayAlias methods should at least return the same name that is passed into the method.

    Roger.

  6. #6

    Default

    HI Roger,

    Thanks for your reply.

    I tried the code in the plugin like the way you suggested. So in this case I didnt configure the stream in StartupStreams.xml since I am returning the same from the plugin (resolveStreamAlias function). However when I hit the stream from a client, I get stream not found error.
    @Override
    public String resolveStreamAlias(IApplicationInstance arg0, String arg1,
    IMediaCaster arg2) {
    if(arg1.equals("test_mp3.stream"))
    {
    return "http://51.21.167.211/sine.mp3";
    }
    else if(arg1.equals("radio_mp3.stream"))
    {
    return "http://45.32.133.148/radiostation.mp3";
    }
    else
    return arg1;
    }
    In all resolvePlayAlias, I am returning stream name as you mentioned. For example:
    @Override
    public String resolvePlayAlias(IApplicationInstance arg0, String arg1,
    ILiveStreamPacketizer arg2){
    return arg1;
    }
    My StartupStreams.xml is blank and there are no .stream files in the content folder. What could I be doing wrong?

    I get following errors in wowza error log when I access http://ipadd/live/test_mp3.stream/playlist.m3u8 :

    WARN server comment 2014-05-06 13:52:18 - - - - - 9.622 - - - - - -- - HTTPStreamerAdapterCupertinoStreamer.onPlaylist: Stream not found [live/test_mp3.stream/playlist.m3u8]: test_mp3.stream
    WARN server comment 2014-05-06 13:52:20 - - - - - 10.857 - - - - - -- - HTTPStreamerAdapterCupertinoStreamer.onCheckAvailability: Stream not found [live/test_mp3.stream/playlist.m3u8]: test_mp3.stream
    Please let me know.

    Thanks again
    Nitin

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

    Default

    Nitin,

    First, do not use .stream file name like "test_mp3.stream" as the alias. Use something like "test_mp3", without the .stream extension. (There is a way to do that if necessary, but names with .stream extension are also aliases so you are aliasing an alias by doing that). Sorry, that was overlooked prior.

    And, you do need a StartUpStream block in StartUpStreams.xml like this (or to start the stream with the MediaCaster API or StreamManager):

    <StartupStream>
    		<Application>live/_definst_</Application>
    		<MediaCasterType>shoutcast</MediaCasterType>
    		<StreamName>test_mp3</StreamName>
    	</StartupStream>
    When StartUpStreams.xml runs when Wowza starts, and test_mp3 is started, that is when IMediaStreamNameAliasProvider2.resolveStreamAlias() fires and resolves to http://51.21.167.211/sine.mp3

    Now play "test_mp3"

    Richard

Similar Threads

  1. VOD file as looping live stream: ingest or media cache?
    By halfpress in forum Live Streaming and Encoders
    Replies: 3
    Last Post: 04-14-2014, 01:46 PM
  2. Wowza Ingest Http Live Stream
    By ozgurdeniz in forum Live Streaming and Encoder Discussion
    Replies: 3
    Last Post: 09-19-2013, 05:32 AM
  3. Ingest UDP stream with H264 to Wowza
    By gcowie in forum Live Streaming and Encoder Discussion
    Replies: 5
    Last Post: 09-18-2013, 06:53 AM
  4. Shoutcast-record and recorded files
    By sonykuba in forum Live Streaming and Encoder Discussion
    Replies: 5
    Last Post: 10-26-2012, 11:57 AM

Posting Permissions

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