HTML/Javascript positioning air.Video object
Hi all,
Simple question which has been doing my head in all weekend!
I have got a simple application that programmatically creates an Air Video object and attaches it to a camera as per
this.video = new air.Video( 320, 240 );
this.video.attachCamera( air.Camera.getCamera() );
I then want to embed that Video object into a specific location on the page (in the DOM). If I use the stage and addChild it just plonks it over the top of anything that's there already. Doing getElementById('container').innerHTML = this.video or similar does not work.
I very much think I am missing something fundamental here but no amount of googling seems to be able to find similar examples to what I am trying to do. All the examples I can find use statically defined HTML<object> tags with fixed urls.
Any suggestions would be much appreciated.
Phil
Check the Security.sandboxType value in the embedded SWF. It should be "localTrusted", in which case you should be able to access both local and remote resources.
There is a bug in AIR in resolving relative file paths in this scenario, that you might be running into. What happens is that Flash Player asks its container to resolve a relative file path. Normally, the container is a browser and returns the resolved path using a common URL scheme that Flash Player understands. However, AIR regards the SWF as being in the application sandbox and returns the resolved path with the app: URL scheme. Flash Player (which is acting just like the plug-in even in an AIR app), doesn't understand the app: scheme, so it doesn't know how to find the file. A workaround is to use absolute paths, which would probably require your JavaScript code to pass the absolute base path to the video player.
As to positioning the Video player, this would require creating a div (or other page element) of the same size as the video and tracking the position of this element on the page. Whenever the position changes, you move the video on the stage (by resetting the video x and y properties). I don't know how much lag in positioning you would run into when the user scrolls the page, especially if the video was playing...
A third option, of course, is to rethink the UI so that you have separate display areas for the HTML and the video.
Similar Messages
-
How can I run a .bat file from an html/javascript adobe air installation package?
I write an html/javascript code which works completely true
but when I made the installation package by air-sdk
it dosent work properly
my code is:
<html>
<head>
<title>Hello World</title>
<script type="text/javascript">
function appLoad() {
air.trace("Hello World");
</script>
</head>
<body onLoad="appLoad()">
<h1>Hello World</h1>
<br />
<button onclick="window.open('file:///C:/Windows/notepad.exe')"> Launch notepad </button>
<button onclick="window.open('file:///D:/opennotepad.bat')"> Launch batnote </button>
</body>
</html>
Chapter 5: Creating your first HTML-based AIR application with the AIR SDKSeems to be security violation. You can't execute bat or cmd
-
Javascript in AIR, bind function undefined
I'm creating an HTML/Javascript based AIR app, but getting the error that 'bind' (a standard JavaScript function) is undefined.
Since bind is being used in a 3rd party library this pretty much kills my hopes of using it unless I wanted to hack through that library, which I don't. I guess this is because the version of WebKit embedded in AIR is not able to support bind for whatever reason (I'm publishing to AIR 13.0)
But I'm wondering if the correct approach is to create an ActionScript based app that uses StageWebView? Is StageWebView using a more updated version of WebKit?
Thanksif I place all of the commands into a single <script> element, the problems go away but it's quite a limitation to only have one document.write in the document. I plan to eventually script re-formatting of the Metadata data so that I can do something like this:
<p>version name</p>
<p>caption line 1 [return]
caption line 2</p>
<p>aperture: f2.8</p>
becomes:
<h3 class="version_name">version name</h3>
<p>caption line 1</p>
<p>caption line 2</p>
<p class="exif">aperture: f2.8</p> -
AIR apps developed using HTML+Javascript
Hi…
I am working on Adobe AIR.
And now I have 3 options to develop AIR applications 1)Flex
2) Flash 3) HTML+javascript.
But can you please explain me when do I exactly use Flex Or
HTML+JS Or Flash.
One of the reason I know is Flex used for Rich UI
applications
Is there any list of requirements for which one of the 3
option is most suitable to use.
And I have some more questions.
1) Can AIR applications(developed using HTML+Js) invoke a web
service running on a different server
2) Can AIR application(developed using HTML+Js) detect the
connectivity of USB drive (I have developed 1 application that can
detect the Network connectivity and periodically reports the status
I want the same in case of USB(plug & play) connectivity)
3) I have one AIR application that has one HTML form on click
of button I am posting the form Data to Java Servlet using
“air.sendToURL()” as shown
<script src="AIRAliases.js" />
<script>
function sendURL()
var url = "
http://localhost:8080/InvokingServlet/Registration";
var variables = new air.URLVariables();
variables.username = document.f1.username.value;
variables.password = document.f1.password.value;
var request = new air.URLRequest(url);
request.data = variables;
air.sendToURL(request);
alert("Data has been added to Remote DB...");
</script>
The data goes to Servlet and then Servlet thru Jdbc
Connectivity adds the data to database “MySQL” database
named “user”
If I read the data from database and print in Servlet it
displays that to “tomcat server window(log)” But I want
the data from Servlet to send back to HTML page where I can display
it on the same HTML page where user entered his details. So even if
I put the result into some Scope like session or request, but Can I
read that it in HTML+Javascript page .
[email protected]quote:
Originally posted by:
pravinpatil23
But can you please explain me when do I exactly use Flex Or
HTML+JS Or Flash.
This question gets asked about once a week. You
can find my latest answer
here
and a little searching will dig up more opinions.
quote:
Can AIR applications(developed using HTML+Js) invoke a web
service running on a different server
An AIR application isn't hosted on a server, so all web
servers are "foreign" to your AIR application. An AIR app does get
downloaded from a server, most of the time, but it doesn't maintain
some kind of special connection to that server.
Because of this, there are no cross-domain restrictions in
AIR like you have in a regular web browser.
quote:
Can AIR application(developed using HTML+Js) detect the
connectivity of USB drive
AIR does not allow low-level system access, and has very
little in the way of platform-specific capabilities. So, you'd have
to use a high-level, platform-agnostic way of checking for the
drive, such as by looking around to see what files are available.
Things like USB insert notifications are way outside the scope of
AIR.
quote:
I want the data from Servlet to send back to HTML page where
I can display it on the same HTML page where user entered his
details.
That question isn't on-topic here. Ask on a forum dealing
with JSP servlets. -
Bug in navigateToURL? (AIR HTML/JavaScript) window name parameter not working
Hi,
I have to popup the default browser from a HTML/JavaScript application.
All links on the Air page should be opened in the same tab in the same browser window that was opened by the first click on a link.
The code I use is
var urlString = "http://www.adobe.com";
var request = new air.URLRequest(urlString);
air.navigateToURL(request, "myNewWindow");
The myNewWindow parameter does not seem to be taken into account: a new tab is opened on every click.
I created a new Air application in Aptana and added the following straightforward code to it:
<html>
<head>
<title>navigateToURLTest</title>
<script type="text/javascript" src="lib/air/AIRAliases.js"></script>
</head>
<body>
<a href="http://www.google.com"
onclick="javascript:air.navigateToURL(new air.URLRequest('http://www.adobe.com'), 'AirTestWindow');return false;">New Tab</a>
<br />
<a href="http://www.adobe.com"
onclick="javascript:air.navigateToURL(new air.URLRequest('http://www.adobe.com'), 'AirTestWindow');return false;">Same Tab</a>
</body>
</html>
Same problem.
Does anyone have any idea?
ThanksIs there really nobody who can answer or at least try to reproduce this?
It's just creating a new Air HTML/Javascript application with one link with a named window target! -
How to Set cookie in AIR with HTML/Javascript
Can someone explain or post example code as to how I can go
about setting a cookie in AIR using HTML and Javascript?
I have an AIR app that requires the user to login on a form
that lives in a non-applicationSandbox. I know how to
create/modified/delete cookies using JS and a web browser, but the
same code returns a cookie with a null value. I'm sure I'm just
missing one line/word of code to make this happen.
The stripped down basics of setting and reading a cookie
using Javascript:
document.cookie("myCookie = yummy");
var taste = document.cookie;
What am I doing wrong?quote:
Originally posted by:
anirudhs
> So if I want to use cookies in AIR html/javascript the
end user will need to have http access, whether it be from a public
or private server?
Yes.
Though I am curious to why you are using cookies to store
state on the client? This is AIR and you have access to the
filesystem, local SQLite DB, encrypted local store, etc.
Thanks for your previous answer anirudhs. Finally got a
cookie thru Air! :P
Some scenario's do require login via cookies for our webapps
(in my case, chat w/ nicks which also logs users by serverside js +
php, thereby allowing the same access method for web-browser login
to the same chat rooms). It might be a bit of a stretch for some of
us to attempt to code filesystem/SQlite/localStore updater for our
web-users via js + php, although I know we could perhaps embed a
hidden flash to do the localStore, and pass data back and forth
from js, but that's lot of extra lifting, whereas browser cookies
are naturally designed for such logins.
I'm confused by the safari wording thou.. does the webkit
security model in Air only work via user activated http (ie.
clicking links), or is there some way Air can initiate an http
connection (say using loader) to set or get cookies? It seems a
pain to need to force the Air user to click and open a dead link
just to activate a cookie session, even if it's only to a hidden
frame. -
Adobe Air - HTML, Javascript and Threading
Hello,
I am developing an application using Adobe Air - HTML and
Javascript. What I am trying to do is to implement threading in
Javascript. I am using implementing threading in Javascript as per
this Neil blog.
Click
Here. It clearly says that this threading works only in Firefox
2.0 and I am trying to use this in with my Adobe Air, but when I
try to refer a function , it gives me error saying "unable to find
it".
I was wondering if this is the best way to go for threading
in Adobe Air HTML application or there is some other way also.
Thanks,
JaikishanHi jjalan,
The yield and generator functionality is only available in
Firefox's javascript execution engine. When you are executing
javascript in AIR, it is done by the webkit and squirrelfish. Take
a look at
http://webkit.org/blog/189/announcing-squirrelfish/
If you can find a javascript library that works on safari /
webkit, chances are high that it may work in AIR.
Also, you can always do pseudo-threading via the age old
setTimeout() -
Convert HTML/javascript AIR app to flex-based AIR app?
Hi all,
I've already built an AIR app using HTML/javascript that I
would like to monetize.
I would like to use O2app's E-Commerce framework, which right
now only supports Flex-created AIR apps.
My question: Is there a simple way to "convert" an
HTML/javascript AIR app to Flex 3 format? I'd rather not have to
rebuild the app from scratch in Flex 3 if I don't have to. :)
Thanks,
AlHi,
There's no simple way to convert an HTML AIR app to flex.
But it is possible to create HTML Root windows from a Flex
AIR App. By root window, I mean the same kind of window that is
launched when you launch an HTML AIR App.
For more info, look at the HTMLLoader.createRootWindow()
call. (This will be available from a Flex AIR app as well) -
AIR HTML+JavaScript app vs. hardware accelerated composing
I'm developing an HTML application for mobiles and desktops. The application is optimized for WebKit based environment. To improve a rendering speed I'm using hardware accelerated layers (something like -webkit-transform: translateZ(0); etc...).
This works great on my iOS devices (using PhoneGap aka Cordova to package a "native" app).
On Windows and OS X I'm using Adobe AIR 3.5 to package a captive runtime HTML/JavaScript based application. I have found this to be the best solution (for now) even though I have tried many others (Cordova for Windows 7 / OS X, TideSDK, ...).
The point is that the HTML rendering in Adobe AIR seems not to be hardware accelerated. Does anyone of you have experience with this? Is here any possibility to enable hardware accelerated layers in AIR HTML rendering?
Thanks a lotThanks a lot, actually I tried AIR SDK 3.6 yesterday and it seems it still doesn't support an acceleration. In a browser it works just fine even in fullscreen (zoomed page). It seems that the best way to achieve my goal will be using Cordova wrappers for OS X and Win Desktop. But as an AIR developer I really want to use AIR SDK So I will do some more tests..
Thanks,
Pavel -
Can I run an html/javascript AIR app on Android or iOS?
Is it possible to compile an already-existing HTML/javascript app to install/run it on any mobile OS (Android or iOS, in particular)? I haven't found anything that says it's possible, only instructions for doing it with a Flash/Flex based AIR app.
I have a large html/javascript app, with a lot of value put into it, and my client would like to be able to package it for use on tablets. Ideally, I'd like to be able to not only have it run there, but also be able to "hide" the html/js code from prying eyes, if there's a way to do that.
Thanks much in advance... I've done considerable research trying to get an answer to these questions.
- JackHi Ross,
the certificate used for APK files is a self-signed one so at this point, no need to use Google Console yet.
See http://helpx.adobe.com/digital-publishing-suite/kb/publishing-process-android-amazon-mobil e.html (Create a certificate file using Keytool)
Testing is only a matter of installing the APK file on the device where you should be able to test.
The Android developer account will be useful for testing if you have in-app purchases matching 'retail' folios. -
Air for Android video object displays on orientation change
I have an Android app that plays a video using the normal video object, ie:
var nc:NetConnection = new NetConnection();
nc.connect(null);
stream = new NetStream(nc);
stream.client = this ;
stream.addEventListener(NetStatusEvent.NET_STATUS, statusHandlerx);
softwareVideo = new Video(640, 480);
softwareVideo.x = 0;
softwareVideo.y = 0;
addChild(softwareVideo);
When the video is playing if there is an orientation change, before the screen adjusts, you can see a full screen version of the video behind the 640x480 in the area of the screen that adjusted yet. So if the video is in portrait and the orientation is switched to landscape, in the right befow the stage adjusts to landcape you can see the right part of a fullscreen version of the video.
Also when I remove the video object you can still see the last frame of the video in that area.
HELP. Is this a bug?Hi,
Please log a bug at bugbase.adobe.com with a sample app(sources,swf,app-xml and assets) with which bug can be reproduced at our end. Also please mention the devices with OS version and the AIR build version on which bug is reproducible. A video demonstarting the bug would be really helpful for us.
Also please mention the bug number here on forum so that we can look into this issue.
-Nimisha -
Hi,
Maybe this is a stupid question.
I'm having some trouble tryng to draw a Video Object into a BitmapData in AIR (iOS), I always though that the security error exceptions were never applied to AIR.
I have a .flv inside a folder in the app, when I try to draw the video I get the classic Exception fault: SecurityError: Error #2123: Security sandbox violation: BitmapData.draw.
Any thoughts?
LuisOkay, I've done more research, so I'll answer my own question.
Yes, it's definitely possible to play video from a server on iOS.
This page contains code that works:
http://www.overdigital.com/2012/01/14/720p-video-on-ipad-and-android-tablets-with-adobe-ai r/
That is, it works properly with the author's video, but not with mine.
At first I thought that it wasn't working at all with my video, but then I happened to change the iPad's orientation, and the video appeared.
This problem has also been noted here: http://forums.adobe.com/message/5712904#5712904
It's interesting that the example video for the above article doesn't do this....
Could it be that I'm not encoding the video correctly?
I'm using the Adobe Media Encoder to encode the video.
The preset I'm using is:
Apple TV, iPad, iPhone 4 and newer - 720p 23.976
I'm choosing this based on the name of the file used by the above working example, which is "Hillman_720p23.976_2400kbps.mp4"
It seems to me that this would obviously be correct. I have a feeling that there's something really simple that I'm missing. Any thoughts?
Thanks,
Douglas -
Photoshop CC 2014 3D positioning in video animation timeline
I'm a mac user and experimenting with the 3D and video timeline features. All I am trying to do is make a small custom shaped logo spin in place although it starts to spin around an axis that is off camera. My instructor at school did the exact same process that I've been doing on her computer, and it worked flawlessly which leads me to believe there is a snap, pin, or setting that my computer has turned on/off. I have found the 'Edit Pins' option in the View tab but I have not been able to select it as it is grayed out. Is that where the answer to my problem is? If not then where? The object that i am trying to rotate in this situation will move from the origin point whenever i try to apply a transformation of any kind, such as rotating, scaling, and moving.
There is a similar problem that i have found on this forum, Photoshop CC 2014: 3D Scene Position Missing - Video Animation Timeline is the title of it although it has not been answered. This question was posted about the same time of my problems started as well. After a good amount of hours I haven't found anything close to an answer.I don't do 3D animations, but Seb Zaremba said it worked in the former Photoshop CC. You can have both version installed on your computer. Go to the Creative Cloud app and Apps>Filter & version>previous versions. There you will find the installer for CC (2013). Give it a try.
Also, you might consider reporting a bug over at feedback.photoshop.com
Benjamin -
Can't find air video in system tray on my pc. Recently updated op system from xp to win7. already reinstalled itunes and synced ipad.
Carol L wrote:
Hi Deggie....I did figure that out since I posted the original question, and I downloaded ther server again and tried it out, but it can't connect. Any ideas?
-> http://www.inmethod.com/airvideo/troubleshooting.html
-> http://inmethod.freshdesk.com/support/solutions -
Can't Stream File using Video object
I'm trying to get my video files to stream from my local version of flash media server to my instance of a flex application. I'm able to connect to the server and I'm receiving the NetConnection.Connect.Success code from the server. When I debug the application, I'm finding that I'm getting NetStatusEvent objects with the codes: NetStream.Play.Reset and NetStream.Play.Start. And the info object's details property is "sample.flv" which is the video file that I have sitting in my "FMSTesting" applicaiton folder. So my video is in my application folder at: "rtmp://localhost/FMSTesting/sample.flv", and my Flex application outputs to the webroot of the flash media server "http://localhost/FMSTesting/bin-debug/FMSTesting.html"
So I'm not sure if my setup is wrong or not, but I think it's ok because I can connect to the server just fine. I just can't get my stream to play on the Video object. Here's my code, please help if you can. I also attached the code
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init();">
<mx:Script>
<![CDATA[
import mx.core.UIComponent;
import mx.rpc.events.ResultEvent;
import flash.net.NetConnection;
import flash.net.navigateToURL;
import flash.events.NetStatusEvent;
import flash.events.StatusEvent;
import flash.text.TextField;
import flash.net.NetStream;
import flash.media.Video;
public var wrap:UIComponent;
public var nc:NetConnection;
public var ns:NetStream;
public var myVid:Video;
public function init():void{
nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS,onConnect);
nc.connect("rtmp://localhost/FMSTesting","bonnetbe");
wrap = new UIComponent();
wrap.x = 10;
wrap.y = 10;
wrap.width =210;
wrap.height = 200;
//public function onSayHello(
public function onConnect(event:NetStatusEvent):void{
myText.text = "The connection is "+nc.connected + event.info.code;
switch (event.info.code)
case "NetConnection.Connect.Success":
myText.text += ("Congratulations! you're connected" + "\n");
makeVideos();
break;
case "NetConnection.Connect.Rejected":
myText.text += ("Oops! the connection was rejected" + "\n");
break;
case "NetConnection.Connect.Closed":
myText.text += ("Thanks! the connection has been closed" + "\n");
break;
public function makeVideos():void{
ns = new NetStream(nc);
ns.addEventListener(NetStatusEvent.NET_STATUS,netStatusHandler);
ns.client = this;
ns.play("sample.flv");
myVid = new Video(200,180);
myVid.attachNetStream(ns);
myVid.opaqueBackground = true;
myVid.smoothing = true;
myVid.width = 200;
myVid.height = 180;
wrap.addChild(myVid);
myCanvas.addChild(wrap);
public function callClient(event:Event):void{
nc.call("magic",new Responder(myResponder,statusResponder), "World");
nc.call("moreFunc",new Responder(myResponder2,statusResponder2),"benjamin");
//myText.text+= "still connected: "+nc.connected;
public function netStatusHandler(event:NetStatusEvent):void{
trace(event);
trace(myVid.videoHeight+" : "+myVid.videoWidth);
public function myResponder(result:Object):void{
myText.text += "the result: "+result;
public function statusResponder(status:Object):void{
myText.text += "some status: "+status.code;
public function myResponder2(result:Object):void{
myText.text += "result2: "+result;
public function statusResponder2(status:Object):void{
myText.text += "status 2: "+status.code;
public function updateFunc(event:Event):void{
changeText.text = "testing: "+nc.connected;
nc.close();
]]>
</mx:Script>
<mx:TextArea id="myText" text="Hello Ben" width="271" height="155" x="311" y="138"/>
<mx:Text x="10" y="192" text="Text" width="144" height="67" id="changeText"/>
<mx:Button x="27" y="378" label="Button" id="funcCall" click="updateFunc(event);"/>
<mx:Button x="135" y="378" label="callFunc" id="callFunc" click="callClient(event);"/>
<mx:Canvas x="311" y="10" width="200" height="120" id="myCanvas"/>
<mx:VideoDisplay x="759" y="62" width="300" height="250" id="vidObj"/>
</mx:Application>Hi,
Your code is perfectly fine except for one statement.
ns.play(
"sample.flv");
Since you want to play vod, give the stream name without extension like - ns.play("sample");
But why you got NetStream.Play.Reset and NetStream.Play.Start events? It is because you have not mentioned the 'start' and 'length' values in your ns.play() method. Which takes the default for 'start' as -2, which means that Flash Player first tries to play the live stream specified in stream_name. If a live stream of that name is not found, Flash Player plays the recorded stream specified in stream_name. If neither a live nor a recorded stream is found, Flash Player opens a live stream named stream_name, even though no one is publishing on it. When someone does begin publishing on that stream, Flash Player begins playing it. Since you have mentioned the stream name with extension, FMS considers it as a stream which is not found in the server and started waiting for a live stream with the name 'sample.flv'.
Best practice is always give the 'start' and 'length' of the stream when calling NetStream.play() method.
Regards,
Janaki L
Maybe you are looking for
-
App or tool to create a stickie or comment on a saved webpage?
Hi, I am looking for an app or tool that will allow me to insert a note or comment (like a stickie) on a webpage I've saved in bookmarks. I know the webpage lives on the owner's server, but at times I want to tag a comment on a page to remind me o
-
Error in using method get_event of class cl_htmlb_manager.
Hi All, i am trying to get the event details in a particular method as follows; data: event type ref to cl_htmlb_event . event = cl_htmlb_manager=>get_event( runtime-> server- >request ). i am getting an error field RUNTIME is unknown ,
-
How to use a session bean in another session bean (or an EJB in a session)
JDev 11.1.1.4, WLS 10.3.4, Windows 7 x64 I have a login controller with a session-scoped bean that manages logins. I have another session-scoped bean that manages menu security. both modules compile and work fine now I need to share the data from one
-
OS X Server 10.4.11 freezes when misc files are being accessed
This is an odd problem, to me at least. It seems as if I have some files that are getting corrupted, that then cause my 10.4.11 server to lock up when they're accessed. Has anyone else run into this problem before? This server is really only used for
-
Firefox 26 causes kernel panic in Mac OS X 10.6.8 when viewing video
Last December 2013 when viewing the video on this site: http://www.telegraph.co.uk/topics/christmas/10534852/Tracking-Santa-Claus-with-NORAD-5-things-you-should-know.html a kernel panic happened on my iMac running OS X10.6.8 "Snow Leopard". (1.83 GHz