# Ingest Shoutcast without using .stream files

**URL:** <https://community.wowza.com/t/ingest-shoutcast-without-using-stream-files/38204>\
**Category:** Wowza Developer Dojo\
**Tags:** wowza-streaming-server-java-api\
**Created:** [April 28, 2014, 11:22pm UTC](https://community.wowza.com/t/ingest-shoutcast-without-using-stream-files/38204 "2014-04-28T23:22:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nitin\_kaplan](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@Nitin\_kaplan](https://community.wowza.com/u/Nitin_kaplan)\
**Post date:** [April 28, 2014, 11:22pm UTC](https://community.wowza.com/t/ingest-shoutcast-without-using-stream-files/38204/1 "2014-04-28T23:22:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Nitin\_kaplan](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@Nitin\_kaplan](https://community.wowza.com/u/Nitin_kaplan)\
**Post date:** [April 29, 2014, 10:41am UTC](https://community.wowza.com/t/ingest-shoutcast-without-using-stream-files/38204/2 "2014-04-29T10:41:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [April 29, 2014, 10:32am UTC](https://community.wowza.com/t/ingest-shoutcast-without-using-stream-files/38204/3 "2014-04-29T10:32:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [May 7, 2014, 12:53pm UTC](https://community.wowza.com/t/ingest-shoutcast-without-using-stream-files/38204/4 "2014-05-07T12:53:44Z")

</div>

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):

```auto
<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](http://51.21.167.211/sine.mp3)

Now play “test\_mp3”

Richard

---

<div class="post-metadata">

**Author:** ![Nitin\_kaplan](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@Nitin\_kaplan](https://community.wowza.com/u/Nitin_kaplan)\
**Post date:** [April 29, 2014, 8:22pm UTC](https://community.wowza.com/t/ingest-shoutcast-without-using-stream-files/38204/5 "2014-04-29T20:22:34Z")

</div>

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](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:

> live/_definst_
> 
> shoutcast
> 
> radiostation.stream

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

---

<div class="post-metadata">

**Author:** ![Nitin\_kaplan](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@Nitin\_kaplan](https://community.wowza.com/u/Nitin_kaplan)\
**Post date:** [May 7, 2014, 1:11am UTC](https://community.wowza.com/t/ingest-shoutcast-without-using-stream-files/38204/6 "2014-05-07T01:11:25Z")

</div>

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](http://51.21.167.211/sine.mp3)”;
> 
> }
> 
> else if(arg1.equals(“radio\_mp3.stream”))
> 
> {
> 
> return “[http://45.32.133.148/radiostation.mp3](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](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

---

<div class="post-metadata">

**Author:** ![Roger\_Littin1](https://avatars.discourse-cdn.com/v4/letter/r/c89c15/32.png) [@Roger\_Littin1](https://community.wowza.com/u/Roger_Littin1)\
**Post date:** [May 1, 2014, 11:05am UTC](https://community.wowza.com/t/ingest-shoutcast-without-using-stream-files/38204/7 "2014-05-01T11:05:30Z")

</div>

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:

- 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.

- The name returned from the resolvePlayAlias method is then passed to the resolveStreamAlias methods. In these methods, you should return the actual shoutcast url.

- The value returned from the resolveStreamAlias methods is what will be used to start the mediaCaster
