Loaded .swf in Adobe AIR cannot find its media files - javascript

I'm developing an Adobe AIR javascript application which loads an .swf file exported from InDesign (interactive book). That .swf has a "MySWF_Resources" directory with a sample .flv video.
The problem is, when I load that .swf into my AIR application using SWFobject it loses the ability to load its assets - somehow the paths are incorrect when run inside AIR environment. The same .swf file executed in a browser properly loads the video from "MySWF_Resources" directory.
Is it possible to somehow force the working directory in which .swf should look for the files? AIR breaks somehow relative paths for included .swfs.

Below is how you would include FLV / movie files via SWF in an air application. You need to use the absolute path of the FLV file since Flash does not know the Air app:/ structure. You can do the following:
Include AIRAliases.js (located in air sdk package)
Include jPlayer (LINK)
Add air event listener for invocation (LINK)
Save the current directory to a variable/object in javascript
Reverse slashes of location ( myVar.replace(/\\/g,"/") )
Pass in the location + file.flv to jPlayer object
Using jPlayer saves a number of steps, but if you would like to do it via standard SWF you need to create the embed/object via javascript and pass in a flashvars for the location of the FLV file. You then have the flashvars set the content source in the SWF via ActionScript (LINK).

Related

How can add .mp3 or .wav file in asp.net mvc project?

I want to play a warning sound using javascript in the cshtml file. I want to put the audio file ( wav or mp3) under the content directory. I want to play this file in the script using the audio library. I tried to add the file with drag and drop on top of the project but it didn't. I don't want to do a database-related operation.
Solution:
Following the steps, I added the audio file to the bottom of the folder I wanted.
"Right click > Add> Existing item"
You should copy the file in a directory in the project and you should let IIS know that mp3 files are legal. For doing this you have to add MIME type in your project's web.config
Please check this LINK for more information about how to add mp3 files mime type in web.config
You should just need to put the audio file somewhere in your wwwroot so it'll be web-accessible when the project is built. Then you can use the external-facing URL in your javascript to actually load and play it.

How to connect CSS and JS to Chromium Delphi locally?

there is a website on wordpress, i load it through TChromium in project Delphi.how to make loading files: css, js, images locally? if the files lie near to exe.
and another question is why TChromium not playing video?
on youtube works, the with video direct link not load(
You can load local files by loading a FILE URL. In case of DCEF3 you would call TChromium.Load and in case of CEF4Delphi or OldCEF4Delphi you would call TChromium.LoadURL.
The FILE URL would look like this :
file:///c:/path/file.html
Read these pages to know more about FILE URLs :
https://www.rfc-editor.org/rfc/rfc8089
https://en.wikipedia.org/wiki/File_URI_scheme
The HTML and CSS files would have to use relative paths to the other resources or the browser will not find them.
Chromium has some security limitations for local files. If you find any issue loading your files with a FILE URL then you could try to load them with a custom URL scheme. CEF4Delphi has a demo called SchemeRegistrationBrowser that shows you how to register a custom scheme.
About the issue with the videos, it's a codec problem. The CEF3 binaries available at Spotify only have the open source codecs enabled due to patent restrictions.
If you need to watch H264 videos then you need to build the CEF3 binaries following these instructions :
http://magpcss.org/ceforum/viewtopic.php?f=6&t=13515
Edit : I forgot that some video players require Flash. Install the PPAPI Adobe Flash Player from here : https://get.adobe.com/flashplayer/otherversions/
CEF4Delphi enables the flash player by default but you might need to use the --enable-system-flash command switch with DCEF3.

Load html in windows strore app from appdata folder

I'm developing windows store app using javascript, html5 and C#. I have developed functionality which downloads zip from web and extracts it to "AppData" folder in "C" drive. That zip file has HTML files. So my question is, I want to display that html in windows app. I'm able to load html from web in iframe but not from local drive. I also tried to do it by giving absolute path in iframe but not working.
Basically, StoreApp's WebView can load the local resource from your app's local storage. "app's local storage" means.. Windows.Storage.Current.ApplicationData.Current.LocalFolder, etc.
If the resources are located outside of your app's local storage, you have 2 options:
Copy the all resources to your local storage.
Create a 'stream' that have all required resources, then give the stream to webview.
1 is easy.
To refer your html resource, use following syntax.
ApplicationData.Current.LocalFolder - "ms-appdata:///local/hogehoge.html"
ApplicationData.Current.TemporaryFolder - "ms-appdata:///temp/foobar.html"
App packages file (like Asset) - "ms-appx-web:///Assets/boee.html"
2 is complicated. Below is an example for 2.
XAML WebView control sample
Use webbrowser.NavigateToString("parameter"). Your question is a possible duplicate: Local HTML File - WebBrowser - Windows phone 7

Opening swf in flash player from javascript

I have a project developed with flex, in which reports are generated as SWF files. My requirement is that when I click an html button on my page, that SWF file should be opened with flash player installed within my system. How can I achieve the same if I want to do with javascript?
If you link directly to the SWF file the browser will attempt to open it. In order to be able to choose if you want to save/open the file in external application you need to alter the HTTP headers - which means some serverside scripting

p2q_EmbedFlash using remotely hosted Flash files

I've embedded a virtual tour on one of my client sites.
The site is hosted by Slicehost, and as you can see the load times for the Flash movies are very slow, so my idea was to serve the swf files from Amazon S3 Europe.
To test it, I have all swfs uploaded to the same directory / bucket on Amazon, while the index.html and p2q_embed_object.js files reside on my local machine. The js file is changed to refer to the Amazon-hosted swfs. The first swf loads fine, but the others don't. What am I doing wrong? Is there a better way to do this that would allow me to serve my Flash assets from elsewhere?
The solution is to use an iframe that calls a separate html file e.g. video.html. This resides in the Amazon bucket and calls the js and all swfs from the same bucket.

Categories

Resources