# Retrieve Publisher or Stream from IMediaStream?

**URL:** https://community.wowza.com/t/retrieve-publisher-or-stream-from-imediastream/55371
**Category:** Wowza Streaming Engine
**Tags:** wowza-streaming-server-java-api
**Created:** [June 10, 2020, 10:38pm UTC](https://community.wowza.com/t/retrieve-publisher-or-stream-from-imediastream/55371 "2020-06-10T22:38:45Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Tyler\_Conn](https://avatars.discourse-cdn.com/v4/letter/t/97f17d/32.png) [@Tyler\_Conn](https://community.wowza.com/u/Tyler_Conn)
#### Post date: [June 10, 2020, 10:38pm UTC](https://community.wowza.com/t/retrieve-publisher-or-stream-from-imediastream/55371/1 "2020-06-10T22:38:45Z")

</div>

I’m trying to implement this [Publish server-side live streams with the Wowza Streaming Engine Java API](https://www.wowza.com/docs/how-to-use-ipublishingprovider-api-to-publish-server-side-live-streams). My goal is when an incoming live stream has a connection issue that causes an unpublish or destroy, then to fill the published stream with a server-side video to fill in the “empty space”. Unfortunately when I try to create a publisher (in “onStreamDestroy”) with the same stream name is says “Stream name already in use: \<stream\_name\>”. My guess was to try to get the existing Publisher from the Stream except I don’t have any Stream objects available, only IMediaStream. Is there a way to get a Publisher from IMediaStream? Or is there an alternative solution to my goal?

---

<div class="post-metadata">

### Author: ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/system/32/447_2.png) [@system](https://community.wowza.com/u/system)
#### Post date: [June 11, 2020, 8:02am UTC](https://community.wowza.com/t/retrieve-publisher-or-stream-from-imediastream/55371/2 "2020-06-11T08:02:48Z")

</div>

There are hundreds of [assignment help](https://www.allassignmenthelp.com/my/) providers in Ireland. But AllAssignmentHelp is one of them. They are offering the best assignment help services to the students at nominal charges. [do my assignment Ireland](https://www.allassignmenthelp.com/ie/write-my-assignment.html)

---

<div class="post-metadata">

### Author: ![Rose\_Power-Wowza\_Com](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/rose_power-wowza_com/32/431_2.png) [@Rose\_Power-Wowza\_Com](https://community.wowza.com/u/Rose_Power-Wowza_Com)
#### Post date: [June 12, 2020, 12:13pm UTC](https://community.wowza.com/t/retrieve-publisher-or-stream-from-imediastream/55371/3 "2020-06-12T12:13:42Z")

</div>

Yes there is and I wrote a blog on it. Wowza has a module just for situations like this. Should you have your stream drop, the connection will remain and it will run a filler mp4 video until your encoder or stream reconnects. This way you don’t drop all your viewer connections and they also aren’t stuck with a black screen.

Hope it helps:

[https://www.wowza.com/blog/loop-a-pre-roll-until-a-live-stream-starts](https://www.wowza.com/blog/loop-a-pre-roll-until-a-live-stream-starts)

---

<div class="post-metadata">

### Author: ![Rose\_Power-Wowza\_Com](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/rose_power-wowza_com/32/431_2.png) [@Rose\_Power-Wowza\_Com](https://community.wowza.com/u/Rose_Power-Wowza_Com)
#### Post date: [June 12, 2020, 9:06pm UTC](https://community.wowza.com/t/retrieve-publisher-or-stream-from-imediastream/55371/4 "2020-06-12T21:06:14Z")

</div>

Gotcha. Yes you would need to know the names of the streams to enter them in the SMIL file. Your solution may require a little extra custom work, but I’d submit a support ticket if I were you and see if our engineers know of a solution I don’t.

If it does indeed need some custom work, no worries, we have a Hire a Consultant forum here and we have Pro Services at Wowza as well, but I’d give the free support ticket a try first. Might be a Java trick that could be used to pull auto pull the random stream name.

[https://www.wowza.com/support/open-ticket](https://www.wowza.com/support/open-ticket)

---

<div class="post-metadata">

### Author: ![Tyler\_Conn](https://avatars.discourse-cdn.com/v4/letter/t/97f17d/32.png) [@Tyler\_Conn](https://community.wowza.com/u/Tyler_Conn)
#### Post date: [June 12, 2020, 9:02pm UTC](https://community.wowza.com/t/retrieve-publisher-or-stream-from-imediastream/55371/5 "2020-06-12T21:02:30Z")

</div>

I saw the page before, but it didn’t read like the stream was being published. I looked at the source code on GitHub and found how the switching is being done, but it says my stream is null

```auto
Stream stream = (Stream)appInstance.getProperties().get(streamName);

```

My implementation uses random GUIDs for stream names, so I cannot use the modules as described in your link. Is the stream being stored in WMSProperties from another step? Looking through the code it doesn’t appear in the GitHub copy.

---

<div class="post-metadata">

### Author: ![marcosandrew](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/marcosandrew/32/1408_2.png) [@marcosandrew](https://community.wowza.com/u/marcosandrew)
#### Post date: [July 2, 2024, 5:01am UTC](https://community.wowza.com/t/retrieve-publisher-or-stream-from-imediastream/55371/6 "2024-07-02T05:01:03Z")

</div>

Hey there,  
Thank you for providing this solution.
