Skip to main content
New Participant
April 22, 2009
Question

using .smil files for dynamic streaming in playlists

  • April 22, 2009
  • 5 replies
  • 15521 views

I have multiple questions, but I feel I would make more sense to explain my intentions.

I have a video player with a playlist written with AS3, along with an .XML settings file to edit the playlist.  I can successfully play rtmp:/ streams from my FMS server on the video player.

Though, I would like to use dynamic streaming using the dynamicStream.smil file with my existing video player/playlist.  Is this a proper approach for what I am trying to achieve?

Lastly, I have been unsuccessful taking the snippet code from the FMS, Dynamic Streaming sample page, and using it within an HTML document.  I assumed all I would need to change were the paths to where the rtmp:// video file, .smil, and the video player files were located on the FMS.  Any ideas?

Any help will be greatly appreciated.

Using: Linux, FMS 3.5, CS4

    This topic has been closed for replies.

    5 replies

    August 7, 2009

    Recreating with a new FLVPlayback() shouldn't carry over any state from the previous instance.  You mentioned Limelight, so I'm curious to know if you're testing this locally or with Limelight?  I apologize in advance that I am not up to speed on the various authentication techniques that all of the CDN's use, but is it possible that subsequent videos you're passing in may be failing authentication?  Also, are you certain all the server's you're connecting to are FMS 3.5?  You must be connected to FMS 3.5.x or else it won't work.  There is a server version check in the component that ensures this.

    Participating Frequently
    August 7, 2009

    Yes, we use Limelight as our CDN.  We were told that they had upgraded 20% of their servers but that we were included in that 20% and were basically given the "green light" to start using the FMS 3.5 features.  To my knowledge, there is no authentication technique to use for on-demand content or at least there wasn't before (live is a different story).  Is there a variable I can access from the FLVPlayback instance so that I can check what version of FMS it is currently connected to?

    After having played around with this issue for awhile, I'm beginning to think the problem lies somewhere in either the NCManagerDynamicStream, ConnectClientDynamicStream or something to do with SMILManager (or one of their parent classes) because I don't have this issue at all when using the standard NCManager class.  When I call into the player to load a new video, it downloads the "player" XML file from our server that defines a bunch of things like video title, auto play, video state (pre, ready, live, etc.) which, in turn, determines whether it is a live stream or an on-demand stream.  It then calls another function after parsing this information that prepares the video player. I use this line to set the NCManager class based on whether the XML file says the video is "live" or "ready" (live or on-demand):

    // Set the appropriate NCManager class

    if (_isLive) VideoPlayer.iNCManagerClass = com.orlive.NCManagerLimelight;

    else VideoPlayer.iNCManagerClass = fl.video.NCManagerDynamicStream;

    // Create new date to use in URL to prevent caching

    var date:Date = new Date();

    // Create new FLVPlayback

    _video = new FLVPlayback();

    // Here I add all my video event listeners

    // Here I set all the video properties like autoPlay, isLive, width, height, etc.

    _video.source = "http://www.server.com/path/to/smilFile.smil?" + date.getTime.toString();

    August 7, 2009

    Brad,

    Just out of curiosity, would FLVPlayback throw a VideoState.CONNECTION_ERROR state change if you had set the VideoPlayer.iNCManagerClass to NCManagerDynamicStream and it tried connecting to an FMS server that was not upgraded to FMS 3.5?


    It shouldn't.  It would set that state if a) it didn't get connected to FMS for some reason or b) the stream name you requested was not found.  Even if the version check fails, it should simply procede forward and establish a NetStream instead of a DynamicStream.  Are you certain the stream names you're passing in are formatted correctly?  If they're MP4 types instead of FLV, are you defining the stream names as e.g. mp4:stream.mp4?  MP4 files on FMS require mp4: prefix and extension unlike FLV which doesn't require the prefix and extension.

    June 22, 2009

    @seanhsmith - NetLimiter is sufficient but not really the best to be testing the dynamic streaming with.  In short, NetLimiter works by sending data, then withholding data for a few seconds alternating.  It isn't necessarily characteristic of real world behavior.  We've mostly switched to using the Shunra desktop client now since it's more reliable.

    Regarding the invalid stream names.  It won't check the validity of the stream names for unsupported characters, etc....  However, the failover behavior in the DynamicStream class (which is what FLVPlayback uses) falls back to the previous stream ID it was playing before it attempted to switch.  If the initial stream play doesn't work, it will likely fail.  I have a note to myself to do some house keeping in this area.  I just don't know when I'll be getting around to it.

    @ewhutson - I'm not familiar of any issues using Telestream content, but that is helpful to know.  I will let our Quality Engineer's know about this.  If you don't have an issue sharing the broken content, I would like to get that to our QE's so that they can add it to our testing metrics.

    Thanks.

    Participating Frequently
    July 12, 2009

    Hi Brad,

    Thanks again for your responses; they have been extremely helpful.  I have one more question that hopefully is quick to answer, but it is somewhat unrelated to the original post of this thread and it involves full-screen mode using the stage.fullScreenSourceRect property.  I noticed the FLVPlayback component automatically takes over the screen when entering this mode and that it can be prevented by setting FLVPlaybackInstance.fullScreenTakeover = false; -- however, this causes it to render at its native size.  My goal is to set the stage.fullScreenSourceRect to the screen resolution of the user's CURRENT monitor (i.e., the monitor the browser uses when going into full-screen mode in a multi-monitor setup).  I have had some success in using ExternalInterface to get the Javascript screen.width and screen.height values, but this only appears to work in Firefox, Safari and Chrome.  IE and Opera always report the primary monitor's resolution... which is also what the screenResolutionX and screenResolutionY properties of the flash.system.Capabilities class apparently always report as well.

    Since we cannot set a "scalable" value to the width and height properties of FLVPlayback (i.e., 100% of the container its container), is there a way to use the fullScreenTakeover method but also allow control elements to be layered on top of it?  Or, is there another, reliable way to detect the current monitor (not primary monitor) through Flash that you know of?  Hulu's media player does not appear to be affected by this issue in any browser and I haven't been able to find a solution for it either.

    Regards,

    Sean Smith

    New Participant
    June 18, 2009

    I too have noticed some unpredictable playback issues, even with FLV Playback 2.5.0.15. When I was testing with the sample dynamic streaming content that comes with FMS 3.5, I found two possible scenarios.

    1) Download the video stream as normal over LAN. Quickly, the player will adjust to playback the highest quality. During playback, I enable NetLimiter to significantly reduce my bandwidth so that I would fall into the lower streaming bracket. Eventually the video buffer depletes and the player goes into buffer mode; however the player never reduces video quality. It eventually becomes a stop-and-go experience for the remainder of the video.

    2) On the same stream, I stopped the video and reset the source. When the video started (NetLimiter is enabled here), I noticed the player continued to run the highest quality and remained there. It spent a couple seconds buffering and once again went into a stop-and-go experience.

    Maybe NetLimiter is to blame here, I don't really trust it and I would have preferred to limit the bandwidth from FMS (the server options don't seem to work). If the OP does get this to work, I would like to know so that I can feel better about my testing environment.

    Participating Frequently
    June 15, 2009

    Hi Jody,

    Could you ask Brad if he can confirm that Dynamic Streaming works with SMIL files and H.264/AAC encoded content in MP4 format?  I was wanting to rebuild our video player using his new FLVPlayback 2.5. component but I have been frustrated to the point that I'm ready to give up.

    We use Limelight as our CDN and I have placed a SMIL file on our HTTP progressive download server "x.com" at the following location:

    http://x.com/test/waf_2385_preview.smil

    Here are the contents of the SMIL:

    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE smil PUBLIC "-//W3C//DTD SMIL 2.0//EN" "http://www.w3.org/2001/SMIL20/SMIL20.dtd">
    <smil xmlns="http://www.w3.org/2001/SMIL20/Language">
        <head>
            <meta base="rtmp://x.com/myapp/" />
        </head>
        <body>
            <switch>
                <video src="mp4:test/waf_2386_preview_180p.mp4" />
                <video src="mp4:test/waf_2386_preview_360p.mp4" system-bitrate="600000" />
                <video src="mp4:test/waf_2386_preview_720p.mp4" system-bitrate="1200000" />
            </switch>
        </body>
    </smil>

    I have the <meta> base pointing to the proper location and have made sure to include the mp4: in the stream names to allow it to properly play H.264 MP4 content.

    Finally, I point the source property of the FLVPlayback instance to the http location of the SMIL file:

    video.source = http://x.com/test/waf_2385_preview.smil;

    The trouble I am having is related to the NetConnection manager(s) that FLVPlayback uses. With the above code, if I set the following before the source:

    VideoPlayer.iNCManagerClass = fl.video.NCManagerNative;

    the first video in the playlist (the 180p file) begins to play fine but it's ALWAYS the 180p file that it plays.  It's as if the FLVPlayback component never performs a bandwidth calculation to determine which stream it should connect to. Setting the video.bitrate property to a static value such as 800000 to have it automatically connect to the 360p file doesn't seem to do anything either... it will still load the first file in the list, which happens to be the 180p file.

    However, to take advantage of dynamic streaming, all the articles I have said you need to use the following code:

    VideoPlayer.iNCManagerClass = fl.video.NCManagerDynamicStream;

    When I use this code, FLVPlayback seems to pull the SMIL file off the server but then does absolutely nothing with it... it doesn't buffer, doesn't fire any video events, nada.

    Any help or advice in getting this to work would be greatly appreciated.

    Regards,

    Sean Smith

    Digital Media Developer

    www.ORLive.com

    June 15, 2009

    Sean,

    For the NCManagerNative method, reverse the order of the bitrates in the SMIL file.  Highest to lowest.

    For the DynamicStream NCManager (which is by default in FLVPLayback 2.5) try defaulting the lowest system-bitrate to 0.

    - brad

    Participating Frequently
    June 22, 2009

    Brad,

    Thanks for the extremely timely response! I hadn't even finished driving home from work when I received the email on my phone.

    In short, I've discovered that the reason I could not get the Dynamic Streaming to function with FLVPlayback and our Limelight account is the fact that the server we are on has apparently not yet been upgraded to FMS 3.5.  I installed the Developer Edition of FMS 3.5 on a spare machine here at work and now Dynamic Streaming works fine.

    Also, to augment what another user has posted, I too am noticing some inconsistencies when using NetLimiter to test stream switching.  Sometimes it works, sometimes it just sits there and buffers repeatedly... I am guessing this is probably an effect of how NetLimiter throttles the bandwidth.

    Thanks again for your help and suggestions!

    Regards,

    Sean Smith

    April 24, 2009

    This worked for me:

    1. I edited the SMIL example in the FLVPlayback 2.5 doc to point to the vod app and to the sample files that install with the vod app. I saved the file as "test.smil":

    <smil>
    <head>
    <meta base="rtmp://localhost/vod/" />
    </head>
    <body>
    <switch>
    <video src="mp4:sample1_150kbps.f4v" system-bitrate="150000"/>
    <video src="mp4:sample1_500kbps.f4v" system-bitrate="500000"/>
    <video src="mp4:sample1_700kbps.f4v" system-bitrate="700000"/>
    </switch>
    </body>
    </smil>

    2. I created an AS3 file in Flash, added the FLVPlayback 2.5 component, and saved the file to the same folder as the test.smil file.

    3. In the Component Inspector I set the source parameter to test.smil.

    HTH,

    Jody

    Inspiring
    April 28, 2009

    Ok, we'll get this dynamic streaming thing working by hook or by crook!  (Whatever that means)

    Jody, I followed your very easy-to-follow instructions above, and I am indeed seeing video playing (the lovely helicopter footage).

    However, it still doesn't seem to be swapping video files when the bandwidth changes.

    If I restrict the bandwidth (using NetLimiter)  way down to, say, 2Kbps, I don't see the quality of the video change.  After about five seconds of playing, the video starts stopping and starting, (barber pole and all), but I don't see things switching to a more highly compressed video file.

    What am I missing?

    Thanks,

    Mike

    April 28, 2009

    i spoke with Brad Outlaw who created the DynamicStream class. he said all you need to do is point to a propertly formed SMIL file from the source property of the component. he also said your issue could be attributed to a bug he found in the component. he's planning to push an update (2.5.0.15) very soon to www.adobe.com/fms_tools.

    seems like we're dealing with a bug...

    jody