Does anybody know how to use the Strobe Media Playback Player in an AIR application?
I need to skip all the configuration that comes from flashvars,I tried to modify the source code but it's a headache.
Hi,
Here is a snippet which would load the player in an AIR app:
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete ="init(event)">
<fx:Script>
<![CDATA[
import mx.core.UIComponent;
protected function init(event:Event):void
{
var playerInstance:StrobeMediaPlayback = new StrobeMediaPlayback();
var parameters:Object =
{
src:"http://mediapm.edgesuite.net/strobe/content/test/AFaerysTale_sylviaApo stol_640_500_short.flv"
};
playerInstance.initialize(parameters, systemManager.stage);
var ui:UIComponent = new UIComponent();
ui.addChild(playerInstance as DisplayObject);
addElement(ui);
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
</s:WindowedApplication>
Unfortunately the control bar will not display since it tries to access the stage property directly. We didn't test AIR integration at all, since this was out of scope for our 1.0 version.
You can try and fix this in the source code. A patch for this would be more then welcome!
Actually, the control bar is displayed, but it is drawn under the status bar.
Use these settings to see the control bar.
var parameters:Object =
{
src:"http://mediapm.edgesuite.net/strobe/content/test/AFaerysTale_sylviaApo stol_640_500_short.flv"
, controlBarMode:"floating"
, controlBarAutoHide:"false"
};
Do you know if there is a way to remove the status bar of the air app?
I hope that the snipets above are enough to get you started.
Cheers,
Andrian
Hey Andrian,thanks for the quick reply.
The player is added on the stage (why full screen??) but I get a compile error:
Error: Error #2067: The ExternalInterface is not available in this container. ExternalInterface requires Internet Explorer ActiveX, Firefox, Mozilla 1.7.5 and greater, or other browsers that support NPRuntime.
Obviously it's trying to communicate with the browser to get the flashvars.
I tried to comment out some configuration code in StrobeMediaPlayback.as,but no luck.
This beautiful player seems like was not meant to live on the Desktop,such a shame!
Slip of the tongue:It was not a compile error,it was a RUNTIME error,otherwise I would'nt be able to run the application at all,right?
I have already taken care of the compile options and experimented with all possibilities.
Did you actually get this to work?In StrobeMediaPlayer.as there's initializing code that configures the player to read flashvars from the browser and the config .xml file,I can't see how this will work in AIR without modifying this configuration code.
In the meantime I found in the OSMF blog this post about a Desktop player built with OSMF-source provided and all ,but it is very basic and with limited functionality.I tried it and it works.
Hi drumaddict71,
Did you manage to get StrobeMediaPlayer player run in an AIR application?
If you still encounter issues with it, please report them here: http://bugs.adobe.com/jira/browse/ST
We'll try to address them as soon as possible. You can also request a sample air application, as an improvement request.
Thank You,
-Andrian
Hey Andrian,thanks for your intesrest.
The player compiled with no errors,I got the player on the stage.however I get the runtime error about External Interface.
Does it make sense to report a bug?The StrobePlayer was not built for the Desktop.The Desktop player I linked to in my previous post,built with OSMF,
works but has limited functionality.
I don't have time to insist on this subject,maybe I am missing something, so I switched to Flex 4's Video Player-which by the way works only with the old osmf swc that comes with Flash Builder and NOT with the new 1.0 swc.(now THAT's a bug.You get a weird Dimension Event compile error with unknown source-wasted one day to solve the problem).
Again,thank you so much for your interest.
Hi,
I published a sample AIR application:
http://smpfmp.appspot.com/SMPAir.air
Here is the zip with the source code of the project: http://smpfmp.appspot.com/SMPAir.zip
Here is the mxml file: http://smpfmp.appspot.com/SMPAir.mxml
The sample loads dynamically the StrobeMediaPlayback.swf.
I commented out the sample code that uses a statically linked StrobeMediaPlayback (the snippet that I used in the posts above). You can use it if you manage to get all the compile options/settings right.
As I wrote previously, the player will use the whole stage size for it's display. Please, log this bug, as well as any other issues and improvement requests.
Let me know if the sample unblocks you.
-Andrian
P. S. If you have ExternalInterface calls it's very likely that you have -define CONFIG::LOGGING true, instead of -define CONFIG::LOGGING false in your compiler options.
Adrian,you are the man!
The dynamic version worked,however I didnt get the static version to work.Here's the modified code,got rid of the unecessary loader stuff
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete ="init(event)"
showStatusBar = "false"
>
<fx:Script>
<![CDATA[
import mx.core.UIComponent;
[Embed(source='/StrobeMediaPlayback.swf')] ????(it was not in the source!)
private var StrobeMediaPlayback:Class;
protected function init(event:Event):void
{
_stage = systemManager.stage;
_stage.align = StageAlign.TOP_LEFT;
_parameters =
{
src:"http://mediapm.edgesuite.net/strobe/content/test/AFaerysTale_sylviaApo stol_640_500_short.flv"
, controlBarMode:"floating"
, controlBarAutoHide:"false"
};
// For statically linked StrobeMediaPlayback you can use this snippet
var playerClass:Class = getDefinitionByName("StrobeMediaPlayback") as Class;
var playerInstance:Object = new playerClass();
playerInstance.initialize(_parameters, _stage);
var ui:UIComponent = new UIComponent();
ui.addChild(playerInstance as DisplayObject);
addElement(ui);
}
private var _stage:Stage;
private var _parameters:Object;
/* static */
private static const ALLOW_LOAD_BYTES_CODE_EXECUTION:String = "allowLoadBytesCodeExecution";
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
</s:WindowedApplication>
The problem is I did'nt find any StrobeMediaPlayback.swf in the source of your project to embed,so I just grabbed the StrobeMediaPlayback.swf from the StrobeMediaPlayback download,and also tried the swf in the bin folder of the StrobeMediaPlayback Flex Project.
I got a runtime error
ReferenceError: Error #1065: Variable StrobeMediaPlayback is not defined.
I will appreciate your help,(again)!
Hi drumaddict71,
Here are the steps to make the player use the staticaly linked StrobeMediaPlayer:
1. Reference the OSMF library
2. Add the source code of the StrobeMediaPlayback to your source path
3. Add the assets.swc (from StrobeMediaPlayback/assets/) to the compile path
4. Set the compile settings to -define CONFIG::LOGGING false -define CONFIG::FLASH_10_1 true for both OSMF and your AIR project.
The embed should not be there. I simply did an experiment and forgot to remove that instruction.
hth,
Andrian
OK,so I included StrobeMediaPlayback.as and all the imports it needed.I used the the OSMF swc from your project and did not bother to complile the library,the compile settings were exactly as you suggested and ...It worked TOO well.The Player appeared : NOT in full screen mode!!??
I made a copy of your original mxml file and modified it for the static version,and then set it as the default application in your SMPAir project.I did a clean build just to make sure I was not running the previous dynamically loaded version,I even removed your original mxml file and did a clean build ,and the player ran perfectly NOT in full screen.
(the full screen button worked of course...).Weird....
Anyway thank you SO much for your help!
Hi Andrian,
I tried it your way and it just won't work. The StrobeMediaPlayer class cannot be found by Flash Builder. I keep getting the error "1046: Type was not found or was not a compile-time constant" Could you explicit the #2 step (thought it was explicit enough but apparently it is not)..? Thanks a lot
Bump!
The comments in the SMP code around fullscreen and StageVideo state that things are not yet finalised --
and I forgot to ask about AIR/iOS support for SMP during the most recent webinar.
As of Flex 4.5.1 VideoDisplay and VideoPlayer are still marked as "not mobile optimised" -- although dropping in the latest osmf.swc (and removing the SDK's osmf.swc) does let you play H.264 progressive video in the iPad emulator at least.
Can anyone clarify the best approach for a "full-featured" video player for H.264 in a Flex 4.5.1/4.6 app targeting AIR/iOS?
Thank in advance!
S
Hi Andrian, tried to use your source and got the dynamic version to play, which worked fine exept that the stage video is not working (The VideoInfoOverlay tells me so). Whats the benefit of using the static version anyways?
i'm using a sdk mix from 4.5.1 and air 3.0 as seen from http://blogs.cynergysystems.com/2011/09/20/creating-a-custom-flex-4-5- sdk-to-target-flash-11-and-air-3/ and the latest osmf 1.6 version..
i am using an rtmfp stream, which works fine and as it should when i test it in the setup.html, where it shows that hardware video rendering is active and stagevideo is available
also set the
OSMFSettings.enableStageVideo = true;
and tried it for the player with
playerInstance.configuration.enableStageVideo = true;
which didn't seem to work.
what am i missing? help would be very appreciated
my flash player version is 11.0.1
Trying to keep this thread alive..
Here's a link to a blog post that says that setting the swf-version and renderMode is required to achieve H.264 playback via AIR3 on iOS:
I've tried this using AIR3 on iOS5 using osmf-1.6.1 and Flex 4.5.1's spark:VideoDisplay.
It works in the emulator but it doesn't work on the device.
I will report back after testing with a custom build of osmf-trunk and using SMP instead of VideoDisplay.
Would be great to get a definitive statement from Adobe about all this...
TIA
S
Hi smarcus,
i am very interested in wether/how you got an AIR3 Project with OSMF to work in the emulator, with hardware video rendering active.. as i fail to even achieve that.. could you by any chance post an example code and describe your project setup? I'd really appreciate the effort!
regards
Here's what I did:
+ overlay AIR 3 SDK on Flex SDK 4.5.1 to create a custom SDK
+ update the custom SDK with playerglobal.swc for Flash Player 11
+ create a new mobile application using custom SDK
+ remove osmf.swc from the default libraries in the Flash Builder project
+ set -swf-version=13 in compiler options
+ add a src folder to the project: osmf-trunk/framework/OSMF
+ set the additional compiler options for OSMF
+ set renderMode in the app descriptor to gpu (or direct?)
At this stage, building a really simple AIR app using the spark VideoDisplay class _should_ work.
I used the AIR sample code linked to above as a starting point and got something that worked in the emulator -- and was excited!
Unfortunately, on the device (iPad2/iOS5), an H.264 clip either crashes the app or just doesn't play.
A VP6 clip plays audio without video.
I also tried using the SMP player from osmf-trunk/player/.
Things look good in the emulator -- but either crash or no playback on device.
I don't know whether the issue is that Flex isn't getting along with MediaSurface support in osmf, or that AIR3 on iOS just doesn't work for video yet. Or perhaps both?
I'm now working on other parts of the app while waiting for Flex SDK 4.6 and AIR 3.1.
Or perhaps someone here can shed some light...
Good luck!
Steven
AIR 3.1 was just released so here's an update!
The SMP info overlay now reports that both hardware decode and stage video are active when running on the iPad!
Unfortunately video is still not actually visible in a Flex application -- but the audio does play and the app doesn't crash anymore.
I suspect that a non-Flex app might actually work. Hopefully this will be sorted out in Flex 4.6?
Curiously, SMP on (mac) desktop AIR has regressed.
In AIR3, hardware decode was enabled but stage video was disabled.
Now in AIR3.1, neither hardware decode not stage video show as enabled.
But video and audio do play.
Can anyone shed more light on this?
S
I am using Flex4.9. My Air app (SMP) loads on android. I need help as follows:
1. Screen Size - Even if I click full size video does not change size
2. Even though i specifically set
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/> <uses-permission android:name="android.permission.WAKE_LOCK"/> Keygurd shuts down video. How do I disable keyguard ? Thanks, V
North America
Europe, Middle East and Africa
Asia Pacific