I was recently asked by a client to take a look at Flash Player 10.2’s new Stage Video. This isn’t for your typical web video display, but for digital signage. There is no nice way to put it but large scale Flash displays (720p, 1080p) have sucked in the past, and when you added in Flash video, it got worse. My client came up with their own solution that, interestingly enough, is very Stage Video-like. It isn’t perfect, and can only run on Linux boxes, so that’s why I was asked to look at Stage Video. I’ve worked with video before in Flash, and have even done my fair share of work with OSMF, but I’m in no ways one of the many experts out there. I know enough to get’r done. There are far more people out there more deeply entrenched in Flash video, so if you feel that I’ve stated anything incorrectly, please let me know and I’ll be happy to update my post.
All my example code (FlashBuilder 4.5 project) is here: LINK
I’m putting the project up instead of links to examples online because I dont want bandwidth issues to play a part in anyones testing, and the clients stuff is all loaded locally as well.
So I started looking at Stage Video about a week ago. I didn’t touch it at all during the beta period. Now, my client was interested in some baseline tests that mimicked some of their use cases. During my tests, I immediately starting running into little issues, that really got me frustrated. I’ve tweeted a few of the problems I’ve encountered, but at this point, I’d have a hard time recommending Stage Video to my client.
Issue #1: Looping of Stage Video [ OSMF Looping fixed with OSMF 1.6 Sprint 5]
My first attempt with SV was extremely basic. I just wanted to play a video and loop it. Easy enough, right? You’d think. I set up my SV example pretty much just like I would when using the “old” way with NetConnection and NetStream, listening for the NetStatusEvent “NetStream.Play.Stop” and then seek(0) and have it loop. In all my tests, I got a noticeable “blink” when the video would loop. I never noticed any blinking of the video if I didn’t seek, or if I paused and did a seek, but if it was just a seek(0), and the NetStream was playing, “blink”. I even tried pausing, seeking and then resuming, and still got a blink. Two interesting tidbits: 1) If I set up a timer to watch the time, and manually looped it about .5 second before the end of the stream, it worked fine, but didn’t work if I tried to manually loop it right at the end, instead of waiting for the NetStatusEvent 2) According to a response to my original tweet, this is fixed in OSMF. Great. really? I have to use OSMF to loop? Okay.. I’m game. . whatever. I’ll be honest, I probably should look at what OSMF is doing under the covers to get around this, because the moment I moved over to using OSMF 1.6 Sprint 3, it was able to loop w/o blinking. Problem solved, right? Just use OSMF 1.6.. Yeah.. not so fast….
I was able to confirm this blink on my 2010 iMac, 2011 MacbookPro and
also a quad-core Dell running Vista. All the computers were running the latest FP 10.2.159.1, except the iMac which is running the latest RC of 10.3
I put an example here on line with the test showing the blink:
I also put a Quicktime capture of the blink on my iMac:
[UPDATE – June 16th]
With the latest OSMF 1.6 Sprint 5, the issue of the video blinking when looping has been resolved. One issue down, more to go!
Bug logged: Flash Player JIRA #6806
Issue #2: Starting OSMF using Stage Video after a Mouse Click
Yeah.. the title should confuse you. What? A mouse click? seriously. After I got over the blinking issue using OSMF, I was setting up tests and using buttons to display the various tests. All the sudden, my videos were playing audio, but not video, until they looped around once, and then the video played on the 2nd loop. WTF? If I forced OSMF to not use Stage Video, things worked just great. No problems. If I took out the button control and had the OSMF Stage Video test start after ApplicationComplete event, things worked just fine. Add in a button and things got weird. I’m completely stumped WTH is going on here. I’ve narrowed down the issue ( I THINK), to autoPlay = true, and loop = true. If I set autoPlay = false, and then mediaPlayer.play() things work. I’m going to chalk this up to a bug in OSMF 1.6 Sprint 3 and I’ll be submitting a bug to the OSMF Jira once I post this and post the Bug report # here. OSMF 1.6 is beta. I get that.
Bug logged: OSMF(Strobe) JIRA #1297
Issue #3: SerialElement
Ok.. This isn’t related to Stage Video, but while I have your attention….here goes. According to Adobe, the Serial Element definition includes “The media elements that make up a SerialElement are treated as a single, unified media element.”. So my silly thinking would say that using a SerialElement that OSMF would handle making sure all those elements are ready to go when needed. Turns out I’m wrong. As OSMF encounters a progressive media element as part of SerialElement, it loads it when it encounters it, and doesn’t preload it at all. So if you have 4 child elements in your serial element, child 2 is only loaded once child 1 has completed. I’m using local assets and its bad enough, so I imagine loading from a web server is only that much worse. After doing a few google searches, turns out that is the intended behavior.. or that’s what I read on an Adobe forum. I’m sure I could dig up the link if anyone is interested. But what a silly thought. Who would want that? So my answer is to preload all the elements myself. Luckily, I found a solution buried (yes, buried) in the OSMF examples. …and guess what? It works fine when using “regular” OSMF, but failed me when I was trying to use OSMF 1.6 with Stage Video. Great.. All I’m asking if for Adobe OSMF team to a) add the ability to tell OSMF to preload the SerialElement child elements….and maybe in the process, take care of the duration issue as well. If I have to handle preloading the child elements myself, and have to tell OSMF the default duration of each child media element, I’m not really sure why I’m using Serial Element at all.
Issue #4: SerialElement Looping
Ok.. so after all the drama of #3 above, I said hell with preloading the SerialElement child mediaElements, and just told OSMF 1.6 to loop the SerialElement using Stage Video. I got pauses between the child media elements, and then it looped, and then things got very weird. I set up 4 child media elements as part of my Serial Element. The first time around, all the videos played. Once the loop started, it played child 1, but nothing displays for child 2, 3, 4.. loops around plays child 1, skips 2, 3, 4..and repeat. Ok.. Another OSMF Jira bug going to get logged.
Ok.. appears this one may already be logged: JIRA # 1226
Issue #5: Stage Video Hardware Decoding and Rendering
What is the secret sauce to get Stage Video to use hardware decoding? I know the hardware requirements on Apple seem to be limited to nVidia GPUs. So that rules out nearly every top of the line Apple system since Apple has switched to ATI. Doesn’t matter who we place blame on for this, but not having hardware decoding sucks. Ok.. on to Windows. I tried my wife’s fairly new Dell quad core with Windows Vista (we didn’t’ get Win7 b/c her office hasn’t upgraded). No dice. Hardware rendering.. no hardware decoding. Okay.. I’ll try one of the Linux boxes at my clients office. yeah. dont laugh…I know.. but for kicks, right? You guessed it, didn’t work. So I really have no idea what magic secret hardware sauce is required for users to get hardware decoding.
Where I’m left at this point:
Even after all the issues above, I’ve managed to find workarounds to at least get my tests working. Stage Video, either when using it as-is, or with OSMF is definitely not a drop-in replacement. I put part of that on OSMF 1.6 still in beta. I’m sure it will get better (hopefully). I have no idea what hardware is required to get hardware decoding, and I’m not even sure if it would solve the video tearing I was seeing when I was using it. Right now, I really can’t see myself recommending Stage Video over my clients home-grown Linux Flash & video solution. It would sure be nice to use Flash for everything, but that’s not a reality at this point. So I’m going to log those bugs in OSMF Jira, keep watching twitter and the Adobe blogs for updates, and maybe we’ll get there eventually.
Side note (and a little more ranting): We really need better examples out there for OSMF and Stage Video. When OSMF first came out, the examples were overly simplistic, or buried deep in the OSMF svn. Documentation was lacking. Now we have StageVideo , and we have some great getting started examples, but I believe if there were anything beyond the extreme basics, some of these issues would have already been spotted.
Thanks for reading and providing any insight into workarounds. I’m really interested to see what sticks I need to rub together to make hardware decoding fire. Who knows…. maybe I’m holding it wrong.