I'm a C# developer completely new to Flash but am attempting to stream a file from Akamai's HD Network using their HD Flash 1.0 configuration.
I have "imported" the video already deployed on the Akamai network, but it seems there is a step where I have to somehow leverage an SWC component to actually make the connection to Akamai work properly.
The docs provided are all using what appears to be a much older version of Flash and don't include an FLA file. However, part of their docs do make it sound trivial to someone more versed in Flash:
Akamai HDNetwork v1.0 - HTTP delivery of FLV files, compatible with
Flash player 10.0 (we call it HDN1 for short) - combine a base NetConnection connected to "null" with a com.akamai.hd.HDNetStream. Follow the samples inside the samples\HDN1.0 folder to find out how to do basic live playback, basic VOD, multi-bitrate
playback, manual switching, sub-clips, and token authentication.
And also:
com.akamai.hd.HDNetStream— is used for HD Flash 1.0 Streaming
I placed the SWC file in the same folder as the FLA I'm working in, and included this code in the Actions window:
import flash.net.NetConnection;
import com.akamai.hd.HDEvent;
import com.akamai.hd.HDNetStream;
trace("Hi!");
// Magic happens here
.. but I just get compilation errors that the import definitions can't be found. So...not off to a good start.
All I want to do is stream the video - no multi-bitrate configurations or anything crazy - just how to get videos playing using our own SWF files. Does anyone know the easiest way to get up and running with this?
Related
I have this problem that when i am running my project in Flash cs6 using ctrl+enter, the project is ok, the flash player is retrieving the files from mysql database. but when i run the independent swf file outside, there is no retrieval happening. the text box that suppose to be showing the retrieved data is empty. how can i fix this?
Make sure you are running the published html from an actual page in the browser and not from the local file system.
Just make sure that the URL doesn't start with file:///
You must be having a security sandbox error, but you probably don't have the Debugger version of the Flash Player, so it's not telling you anything.
Just go to http://www.adobe.com/support/flashplayer/downloads.html and choose the proper one for your operating system and browser.
If you STILL want to run the files from your local file system, you can have a look at Flash Player's Global Configuration, to give access to the files/directories you want. Just right click on your swf file in the browser, and when the Menu opens, select Global Configuration.
The reason it is working when running inside Flash CS6 is that the player has less security restrictions in there.
Let me know if you were able to solve your problem.
I have been working on the Asteroids Game example code that they give in the tutorials section of the wiki and I ran into a strange error.
The code works just fine in my development environment, Eclipse. The game runs without error and exits normally.
I go through the export process in the file menu and create an executable jar that when run with this batch file code
java -Djava.library.path=D:\Tools\lwjgl-2.8.4\lwjgl-2.8.4\native\windows -jar SpaceInvaders.jar
Starts the display and the fails when it trys to load a wav file. Giving this error.
Exception in thread "main" java.lang.NullPointerException
I traced to where in the code this is happening and it is at the location where the wavs are being loaded. Apprently outside of the environment it can't locate the files even though they are right next to the code? All my wav files and gif files are just in the same directory as the java class files right now so calling them from the code looks likes this:
http://i.imgur.com/2gnN1.png
Searching for stuff on google it tells me to zip them into a seperate file and then import to the class folder and refrence from there. I was wondering if there was a way to keep the files inside my main jar file instead of having to create a seperate entity.
Thanks for the replys! Let me know if more information is needed.
You may want to consider using a higher-level API, such as the 3d soundsystem from paulscode. SoundSystem can read from inside the jar(like you are asking), and automatically switch to java sound if LWJGL sound isn't supported on the current hardware.
I have a Flash AS3 application that uses FileReference.browse() to request a SWF from the user. If the chosen SWF is AS3, I'm good to go. However, if it's AS2, I need to load it into an AS2 wrapper first (so my app can alter it). All of these files (including my app and wrapper) are intended to exist locally on the user's machine, but the file they select can exist in any directory. So to be clear: Main application (AS3) -> Wrapper (AS2) -> User's file (AS2)
I know how to get the uploaded file's ActionScript version from the Loader's loaderInfo.actionScriptVersion variable, and that's working correctly. My issue is how to pass the file from the AS3 application to the AS2 wrapper so it can load it.
My first thought was to dump the ByteArray from the FileReference's load() function into a SharedObject "cookie". This method seemed pretty bad from a user-experience point of view, but it seemed most likely to work. However, I've been unable to find any method within AS2 to load the ByteArray as a movie (in fact, AS2 doesn't even seem to have a ByteArray class). So the first potential solution to my problem would be if anyone knew of a method for loading a movie from a ByteArray in AS2.
My second thought was to pass the uploaded file's path to my wrapper via the already-setup LocalConnection bridge, and then just have it load the file from that. However, I can't find any way to get the file's path, and my Googling suggests the security model intentionally prevents it. Not to mention, I'm not sure I can load an arbitrary file from the user's machine.
My "hands up in the air; I give up" solution was to just create separate buttons for loading AS3 and AS2 files (leaving it up to the users to guess which it is!) and have the AS2 button actually within the AS2 wrapper. However, it looks like AS2 doesn't have a file browsing uploading API, and the PHP-hybrid solutions I've found aren't an option (because this is meant to be run locally).
So, I would be eternally grateful if anyone could point me in the right direction for solving any of these three roadblocks. Alternative workarounds are of course welcome.
(Edit)
Ok, I found the documentation for AS2's version of the FileReference class. It supports the same file-browsing capability, but does not support directly loading the selected file into the SWF.
However, the security sandbox doesn't seem as strict for local files as I expected, and it looks like I can load any SWF on the user's machine once I have a path to it. So I should be able use JavaScript and an HTML form with a file input to get and pass the file path to my application. It's not ideal having to do all of this from within a web browser, but it should work. If it turns out satisfactorily I'll submit it as an answer.
(Edit 2)
Scratch the HTML-form idea. Looks like the path is hidden from JavaScript for the same reasons Flash hides it. The only option I can think of now is to have the user copy and paste the path to the file...
After reading over your post, you may be able to retry one of your previous attemps with some new information. Actionscript 2 DOES have a method for looking up files from a browser, same as AS3 does. AS2 also has a FileReference class. Check out the documentation here:
http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=00001040.html
Also, here is a tutorial:
http://markshu.ca/imm/flash/tutorial/fileReference.html
Well, all of my other leads have dried up, so I'm submitting the two answers that will actually work, although neither is ideal:
A) Use Adobe AIR, which will give more access to the filesystem (such as for getting path info) at the cost of requiring the separate AIR runtime to be installed.
B) Have the user enter the path to the file themselves (cumbersome for the user)
I tested this flash application in Flash IDE, it never through this error. But When I uploaded in server, got this error. Why we getting this VerifyError? It is a flash application loads all the library assets through bulk loader, later it will get assets from bulkloader to display in the main page. Assets includes swf,xml etc.
Usually this happens when loading external SWF files, which are using a different version of classes that are in the main application.
This could be because you compiled some RSL's, modules or other external SWF against a different version of the Flex SDK. It could also be that you changed a class and didn't recompile all of the SWF's again.
Sometimes you can do everything right, but an old SWF is cached by your browser, and so is incompatible with your main application. You can get around this by adding the version number to file names, so that an old cached version is never used.
I built an AS3 image gallery using FlashDevelop.
Before I zip up the application, I can run the image gallery in my browser by simply opening the index.html for the project. Everything works perfectly.
I then zip up the project as proj-0.1.2.zip using winrar.
I then unzip this newly created zip and try to load the application using the project index.html like above. The gallery doesn't function properly. From seeing what happens, it appears as though the image metadata is not present(but I'm not sure, see below).
There are other applications as well that are broken. Videos don't load. If an application doesn't depend on any external assets then everything looks fine.
Another thing..If I then build the FlashDevelop project and republish the swf..then it works in the index.html like I want. What is going on here?
I want people to be able to fire up my demo apps out of the box by just running the index.html. If that doesn't always work and they have to figure out that they need to rebuild the SWF then that's pretty bad.
I don't think zipping is the problem, I think moving to a different folder is a problem.
I assume you are running this index.html on your local PC, and not on a webserver?
By default, Flash cannot access from a local SWF to load other local files. However, FlashDevelop / Flash CS3 / Flex Builder, in order to get around this restriction, set some flags in the flash player telling him "This SWF is a trusted SWF, allow him to open local files". But it's based on the exact location of the SWF.
There's a setting somewhere in the compiler, that sets a flag in the SWF saying "This SWF can access local data", but there's one downside: It blocks all access to network resources. So it's either/or: access local data, OR access network resources (anything that goes over HTTP, Socket, etc). I'm not sure where this setting is offhand. It may be that the default setting for Flash CS3 is different than the default setting for FlashDevelop.
Anyway, the easy way to avoid all this issue is to not run the file locally. Put it on your webserver before testing.