• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem with Cocoa on Java.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with Cocoa on Java.


  • Subject: Re: Problem with Cocoa on Java.
  • From: Ilan Volow <email@hidden>
  • Date: Wed, 2 Jul 2008 16:19:03 -0400
  • Domainkey-status: no signature

You might want to take a look at doing it in regular Objective-C using Apple's QuickTime Kit framework.

http://developer.apple.com/documentation/QuickTime/Conceptual/QTKitProgrammingGuide/Chapter01/chapter_1_section_1.html#/ /apple_ref/doc/uid/TP40001245-CH202-TPXREF101

-- Ilan

On Jul 2, 2008, at 12:27 PM, Antonio Di Ferdinando wrote:

Hi all,
I'm quite fresh of this mailing list (and to cocoa), so please accept my apologies if there is something wrong with the subject.
I have a problem using Cocoa in my Java application.
In the big picture, I am developing an application that needs to display contents on a continuous basis, in a way similar to those advertisement screens that is possible to find in metro stations, etc. The application contains a (Java) class that takes a path as input parameter and plays the movie found at the location of the path. This action is repeated on average every 40 secs, and paths are obtained dynamically (thus I cannot force the class to play this or that movie).
Internally, in the Java class i define an applescript script and an NSAppleScript that executes the script. The excerpt of code for the execution of the applescript script is below ('script' is the applescript script I use to start the application and play the movie):


NSAppleScript myScript=new NSAppleScript(script);
NSMutableDictionary errors=new NSMutableDictionary();
System.out.println("Starting script execution");
myScript.execute(errors);
System.out.println("script executed");
if(errors.count()>0)
	System.out.println("errors: "+errors.toString());

In my tests, I am using VLC or QuickTime as players.
When I use VLC, the applescript script I use is:
String script = "tell application \"VLC\" \n" +
               "\t OpenURL \""+path+"\" \n" +
               "\t play \n" +
               "\t next \n" +
               "\t --quit application \"VLC\" \n" +
               "end tell \n";

When I use QuickTime Player, the script I use is:
String script="tell application \"QuickTime Player\" \n"+
"\t open file (\" "+path+" \" as POSIX file) \n"+
"end tell \n"+
"delay 15\n"+
"tell application \"QuickTime Player\" \n"+
"\t quit \n"+
"end tell";
What apparently happens, and is my problem, is that at a certain point the NSAppleScript does appear to return, and thus the Java class is insensitive to the subsequent calls. In other words, looking at the code snippet above: on a normal execution, the application would print on screen:


Starting script execution
script executed

while on a 'problematic' execution what I have is only:

Starting script execution

and the application ceases to work.
I don't know whether this is an issue related to the actual applescript script or the execution of the NSAppleScript itself, and can't work out a way to get rid of this. The OS is 10.5.4, and the Java use is the latest released for Mac but compiled with Java 5 standards.
Does anybody know what's wrong with this? Or, alternatively, other solutions?


Thanks in advance.

Antonio.
http://san.ee.ic.ac.uk/~diferdin

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Problem with Cocoa on Java. (From: Antonio Di Ferdinando <email@hidden>)

  • Prev by Date: Re: A question of style: Returning 'pairs'
  • Next by Date: Re: Good mouse tracking design for dynamic view?
  • Previous by thread: Re: Problem with Cocoa on Java.
  • Next by thread: tracking area problems on 10.4.11
  • Index(es):
    • Date
    • Thread