try this from the Apple support site
ymptoms
Learn what to do if you can't eject a CD or DVD (stuck media) or open the drive tray.
Products Affected
iMac
Resolution
Important: Make sure the disc is not in use. Quit all applications that are using files on the disc.
1. Place the computer in sleep mode.
2. Press the Media Eject key at the top-right corner of the keyboard.
3. If that doesn't work, drag the disc's icon to the Trash.
4. If that doesn't work, restart the computer, then hold down the mouse button.
To restart, choose Restart from the Apple () menu.