Strobe Media Playback: Wrapped
Strobe Media Playback (SMP) has quickly become my Flash media player of choice.
Built by Adobe - using the Open Source Media Framework (OSMF) - it's simple to use, yet powerful; and thanks to being open source, the project is available for all to download, modify, and re-build at will. Which, as it turns out, is rather handy.
For a recent project I needed to -quickly- implement a Flash video player that supported various streaming protocols, and would play nicely when loaded/controlled by some other Flash content. For me, SMP was the obvious choice.
The standard player supports being loaded by another SWF - passing any flashvars from the loading SWF on to the player - but for this project I needed more control over the configuration, positioning, size, and full-screen behaviour. With a few small changes to StrobeMediaPlayback.as, and a new wrapper class to make loading and configuring the player from Flash nice and simple, I had what I needed.
When modifying the player, my aim was to retain all the original functionality and behaviour when embedded into HTML - so the same player can be used everywhere, as you should see at above... However, *caveat alert* I can't guarantee that, so if you end up deploying this somewhere important be sure to test it works as expected beforehand.
Changes to the player were made in the StrobeMediaPlayback document class:
- Added an option to stop the automatic initialize() call when the player is added to the stage - to allow initialising the player with custom sets of parameters, not necessarily from the loaderInfo parameters.
- Added optional width/height parameters to the initialize function, where passing 0,0 causes the player to fit the full size of the stage.
- Added a resize function that can be called any time after initialisation.
Get the wrapper code and tweaked StrobeMediaPlayback here. There's a little read-me in there to help you get started working with the wrapper and/or rebuilding the player, and the changes are documented in comments at the top of the StrobeMediaPlayback class.
The wrapper and player modifications are built on version 1.5 of StrobeMediaPlayback - you can view/download the various SMP distributions on sourceforge.












Thanks for writing this!
Can you briefly describe the improvements that you did?
Also, I think it’s worth mentioning the Strobe Media Playback is licensed under the BSD License – so there are no strings attached to it.
Other open source projects force you to buy commercial licenses once you start making money with their software.
-Andrian
[...] This post was mentioned on Twitter by Andrian Cucu. Andrian Cucu said: RT @mikedotalmond: Found time to squeeze out a blog post: http://j.mp/egmK5x #StrobeMediaPlayback #OSMF [...]
Hi Andrian, that’s a good point! The BSD licence is, indeed, a treat
I’ll put together a list of the changes I made to the player soon.
Andrian: I’ve updated the post with a brief description of the changes to the StrobeMediaPlayback document class.
hi Mikea..
very nice post.. i am trying to use this code.. i got this error in StrobeWrapperTest.swf
Error #2044: Unhandled Error loading the IStrobeMediaPlayback SWF
function Function() {}:. text=
can you guide me?
thanks Mikea i find out the solution for above problem.. but the player not play the video….
I think I love you for this
I’m using your wrapper for a Flash Projector ..unfortunately its set to full screen from the start, so when I pull in Strobe it automatically goes full screen also. Your resize functions are ignored and I don’t have Flex to compile a custom Strobe. Is there any way to trick the player into thinking StageDisplayState.NORMAL?
Just what I was looking for – thanks!
Just one thing – I’ve tried & failed – but how can you listen for COMPLETE on the video? i.e. call a handler when the video finishes playing?? Tried (in wrapper) stuff along the lines of
_player.sprite.addEventListener(TimeEvent.COMPLETE, foo);
but no go – any ideas?
This wrapper seems to work great in Flash, but fails when used inside a Flex app (SDK 4.5.1) it fails on initializePlayer() “Cannot access a property or method of a null object reference.”
I think the problem is related the addChild method for the sprite . You can’t call that on the stage in Flex. I updated the wrapper to pass in a UIComponent parameter that I use for the addChild. That seems to work.
Hi Mikea!
This is great, thank you VERY much!
I am having a problem just using the StrobeWrapperTest code copied directly into my app. I get an error:
TypeError: Error #1034: Type Coercion failed: cannot convert StrobeMediaPlayback@2c361041 to IStrobeMediaPlayback.
at StrobeWrapper/onPlayerLoaded()
when I launch. If I try to load it in the debugger, I get:
Attempting to launch and connect to Player using URL /Users/christopherburns/Development/Flash/MediaAffinity/MA Test.swf
[SWF] Users:christopherburns:Development:Flash:MediaAffinity:MA Test.swf – 6754 bytes after decompression
*** Security Sandbox Violation ***
Connection to file:///Users/christopherburns/Development/Flash/MediaAffinity/StrobeMediaPlayback.swf halted – not permitted from file:///Users/christopherburns/Development/Flash/MediaAffinity/MA Test.swf
SecurityError: Error #2000: No active security context.
The files are all in the same folder, and names have been checked for consistency in content and case.
Any ideas?
Cheers,
Chris
Hey,
It looks like you’re not implementing the interface IStrobeMediaPlayback in your implementation of the StrobeMediaPlayback SWF (and if you’re using the stock player, you’ll need to re-build it with the document class implementing IStrobeMediaPlayback)
The sandbox error you’re getting after that is probably because you’re loading / running the files locally, and not on a webserver.
Thanks for the quick response! I got it working… to a certain extent.
We are trying to use this thing to play a F4M file. If I load the plain-vanilla StrobeMediaPlayback.swf into an app (.NET) and run it with this URL as the source:
http://mps.hwcdn.net/i8u4j2p8/ads/LoveGuru.smil/manifest.f4m
It works just fine.
When I try with the wrapped version, I get a “We are unable to connect to the content you have requested. We apologize for the inconvenience” message.
Could something have gotten switched off, like the handling of F4M in the wrapped version?
The AS3 code I am using is identical to the StrobeWrapperTest code you deployed, with the one change of the URL I am sending into the video params:
const params:Object = StrobeWrapper.getVideoParameters(“http://mps.hwcdn.net/i8u4j2p8/ads/LoveGuru.smil/manifest.f4m”);
Any input greatly appreciated.
Cheers,
Chris
Hai am trying to load you tube plugin in your strobe wrapper class,But i cannot load.
Here my code .
if (extras) { // add any extra params the user has passed in
for (var k:String in extras) params[k] = extras[k];
extras.plugin_YouTubePlugin=”http://ivb7.com/player/YouTubePlugin.swf”
}
If any mistake please correct it.Its very urgent requirement
Hai am trying to load you tube plugin in your strobe wrapper class,But i cannot load.
Here my code .
extras.plugin_YouTubePlugin=”http://ivb7.com/player/YouTubePlugin.swf”
if (extras) { // add any extra params the user has passed in
for (var k:String in extras) params[k] = extras[k];
}
output Window shows
we are unablw to connect to the content you’he requested.We apologize for the inconvience
If any mistake please correct it.Its very urgent requirement