Hi there,
I was trying to figure out how to play a video from file. I found an example in "Developing Acrobat Applications Using JavaScript" on page 133... so I decided to take a shot on creating a javascript file and saving it in my usr folder [C:\Users\kmoniz\AppData\Roaming\Adobe\Acrobat\8.0\JavaScripts].
For some reason, nothing happens when I click on my menu item.
Here is my javascript code:
var myVideo = "/C/Users/kmoniz/AppData/Roaming/Adobe/Acrobat/8.0/JavaScripts/surgery.mpg";
var args = {
URL: myVideo,
mimeType: "video/x-mpg",
doc: this,
settings:
{
players: app.media.getPlayers("video/x-mpg"),
windowType: app.media.windowType.floating,
data: app.media.getURLData( myVideo,"video/x-mpg" ),
floating: { height: 400, width: 600 }
}
}
var settings = app.media.getURLSettings(args);
args.settings = settings;
// Create a trusted function to execute a video
trustedPlayVideo = app.trustedFunction( function (args)
{
app.beginPriv();
app.media.openPlayer(args);
app.endPriv();
})
app.addMenuItem({
cName: "Play Video",
cUser: "JS: Play Video",
cParent: "Advanced",
cExec: "trustedPlayVideo", nPos: 0
});
I believe that there may be something wrong with my file path.
If anyone can help me out with this I would greatly appreciate it. I am new to Acrobats javascript development side.
Ok, it looks like I forgot to place parantheses within my addMenuItem cExec call. Modified-> cExec: "trustedPlayVideo", nPos: 0So, now when I click on the menu item in Acrobat, i get the following error on the javascript debugger:
args.doc.media has no properties
invalid 'in' operand a.doc.media
invalid 'in' operand a.doc.media
invalid 'in' operand a.doc.media
Does anyone know what I could do to solve this issue?
Thanks in advance.