Results 1 to 5 of 5

Thread: Cannot get new Playlist to open on existing Stream

  1. #1

    Default Cannot get new Playlist to open on existing Stream

    Hi All,
    I am working on a "scheduled streaming" module based on the sample code provided here

    The schedule loading works properly only when I start/restart the application. I cannot get the schedule to change when I create a new Playlist and assign it to an active stream.

    The most notable change I've made from the original code is that I am attempting to reuse the existing streams, rather than creating new Streams every time a playlist is loaded.

    //only create a Stream if one of the same name does not already exist
    if(!streamMap.containsKey(streamName)){
    	Stream stream = Stream.createInstance(appInstance, streamName);
    	streamMap.put(streamName, stream);
    	appInstance.getProperties().setProperty(streamName, stream);
    }
    Once a new playlist is loaded, the TimerTask runs correctly, and attempts to open the playlist on the existing stream:
    public void run() {
    	if(mPL.open(mStream))
    		getLogger().info("Stream switched to new Playlist: " + mStream.getName() + "->"+mPL.getName());
    	else
    		getLogger().error("Unable to update Stream to new Playlist: " + mStream.getName() + "->"+mPL.getName());
    }
    I ALWAYS see the error message at this point, indicating that Playlist.open() has returned false.

    Can you provide any clues as to why this would be? Do I have to recreate the Stream every time a playlist is loaded? The API documentation seems to support my approach, but I am at a loss here.

    Thanks in advance

  2. #2
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    Take a look at this example of how to dynamically control Stream class streams

    Richard

  3. #3

    Default

    Hi Richard,
    Thanks for the quick reply. As far as I can tell, I am following that example.

    Specifically, I need to know in what cases calling Playlist.open(Stream) would fail - so that I can debug further.

    I have a reference to a Playlist, and a reference to a Stream, yet Playlist.open(Stream) always returns false and nothing changes in the playback.

    From the API documentation:

    open
    public boolean open(Stream s)
    Opens this playlist on the given stream... stopping anything currently playing on that stream and switching over.
    Parameters:
    s - - stream to play on
    Returns:
    - true if successful

    Obviously, there are reasons why this method would return false and fail to update the stream - I just need some guidance on what those conditions could be.

    Thanks

  4. #4

    Default

    Just wanted to report back that I have determined the issue and rectified it.

    I began this project using various samples provided in these forums, and I had left the pre-compiled ServerListener "ServerListenerStreamPublisher" active in my installation.

    The server listener was competing with my custom Module, and the signals got crossed causing erratic behavior.

    Removing that ServerListener allowed me to address the problems in my own code properly.

    Thanks

  5. #5
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    Great. Glad it's sorted. Thanks for the update

    Richard

Similar Threads

  1. Replies: 3
    Last Post: 05-21-2014, 09:30 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
  •