QTMovieView (Plays Audio, but no Video)

I’ve been trying to get QTMovieView to play a video, and all it plays is the audio. MovieView remains black.

Here is the Code:

property movieView: missing value
    on LoadMovie_(Sender)
        set theMoviePath to POSIX path of (choose file with prompt "Choose a movie:" without invisibles)
        tell current application's QTMovie to set {theMovie, theErr} to movieWithFile_error_(theMoviePath, reference)
        tell movieView
        end tell
    end LoadMovie_

I pulled it from this old Post: http://macscripter.net/viewtopic.php?id=34149

I even tried starting from scratch and only using the code above. It loads the file with no errors, but it only plays the audio just like in my main app. Any advice? Different ways to write it?

UPDATE: It appears that when I click the button that is attached to the LoadMovie_ handler it locks up the application and freezes visual updates (i believe thats called application drawing?). So it may not be that QT is not playing video, it appears that…

tell movieView
        end tell

…is locking up the application. Any ideas?

Hi There

I had a similar issue. What it boiled down too was the “Load State” of the movie. When you tell QTKit to allocate
a new movie, before it is playable, it needs to load a certain amount of the movie before it can play.
With your code, you are trying to play the movie before it is “playable”

The Easy Way to fix - change play_(me) to autoplay() or autoplay_(me) . That tells the movie view to play the movie as soon as enough movie data has loaded.

The more difficult way ( but better in the long run as your app gets more functionality)

Either check (theMovie’s movieAttributes()'s QTMovieLoadStateAttribute) as real) with a timer of sorts


Use NSNotificationCenter - eg NSNotificationCenter’s defaultCenter()'s addObserver_selector_name_object_(me, “checkLoadState:”, “QTMovieLoadStateDidChangeNotification”, theMovie)

The notification only tells you the the loadState has changed, you need to make your code do the rest.

Good Luck


Thanks for the information as i’m sure I would eventually run into the problem as well. Shane Stanley actually narrowed it down to my “Auto Layout” being turned on here: http://macscripter.net/viewtopic.php?id=34149