Announcement

Collapse
No announcement yet.

How to display 'now playing' info in a screen saver?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to display 'now playing' info in a screen saver?

    I'd like to be able to display now-playing info from iTunes or other apps in a screen saver. Any advice on how to do this?

  • #2
    Do you mean in your own screensaver or an existing one? In your own screensaver (if written in Cocoa), you can use following code to get info from iTunes (result is a dictionary with current time and names of the track and playlist).


    Code:
      NSMutableDictionary *moduleSetup = [NSMutableDictionary dictionary];
      NSAppleScript *asExecutor;
        NSAppleEventDescriptor *asResult;
        asExecutor = [[[NSAppleScript alloc] initWithSource:@"tell app \"iTunes\" to get {player position, index of current track, index of current playlist}"] autorelease];
        asResult = [asExecutor executeAndReturnError:nil];
        [moduleSetup setObject: [NSNumber numberWithInt:[[asResult descriptorAtIndex:1]int32Value]] forKey:@"CURR_TIME"];
        [moduleSetup setObject: [NSNumber numberWithInt:[[asResult descriptorAtIndex:2]int32Value]] forKey:@"CURR_TRACK"];
        [moduleSetup setObject: [NSNumber numberWithInt:[[asResult descriptorAtIndex:3]int32Value]] forKey:@"CURR_PLIST"];
    If you want to display some info over an existing screensaver, check the NSWindow documentation in Cocoa reference. I have not tried it, but it appears that a window in NSScreenSaverWindowLeven might allow you to display something above the screensaver...

    Comment


    • #3
      Hopefully in an existing one. Thanks for the code, though. If I have to roll my own it'll come in handy.

      Comment


      • #4
        Have you tried using Quartz Composer? I'm not sure how it could interface with apps like iTunes, but it's really easy to make cool-looking screensavers regardless

        Comment


        • #5
          Quartz Composer

          Originally posted by Mahalis
          Have you tried using Quartz Composer? I'm not sure how it could interface with apps like iTunes, but it's really easy to make cool-looking screensavers regardless
          Fa'a Mahalo, bra! That's a great tip. I found Engadget's article about making a screensaver via Google, based on your suggestion. HOW-TO: Make a customized RSS screensaver in Tiger

          For those as clueless as me, Quartz Composer is a part of Tiger (Mac OS X 10.4).

          Comment

          Working...
          X