Playing movies with QTMovieView

Discussion in 'Mac Programming' started by zabbadu, Dec 2, 2008.

  1. zabbadu macrumors newbie

    Joined:
    Jul 27, 2007
    #1
    So, I'm curious if anyone has tinkered around much with the QTKit.

    My problem set is actually pretty simple. Just a movie viewer. A window, with a QTMovieView.

    The project is a Cocoa Application, not a Document-based project, though.

    I have added the QTKit.framework to my project & set up the UI in IB. The UI has one QTMovieView & a button titled "Play".

    I've set up the outlets & actions, etc correctly [I believe]. For now, I've hard-coded the path/filename into the program. When I click the play button, though, the movie doesn't play.

    Since I couldn't get it to work, I thought I'd [*gasp*] check out the documentation for the QTKit, QTMovieView and QTMovie. I followed one of the tutorials. The first thing that stood out in the tutorial was that I created a document-based project & added the view to the MyDocument.nib's Window.

    I did just add an NSLog line in the code that is connected to the play button, because I wasn't convinced that the function was even being called. When I built & ran the project & clicked the button, the NSLog message was output to the console. So, it is being called.

    One half of my brain thinks it makes a little bit of sense that it works this way but not the other way, since movies are documents. But the other half of my brain is stubborn & thinking that they're both just windows with views on them and my code should work. Alas, it does not.

    If code would help, I can post it. If I do that, though, please keep in mind that I really just whipped out the code for the app as a learning exercise, not for a class, or work project. I was just curious to see if anyone else had any thoughts as to why this might be happening.
     
  2. HiRez macrumors 603

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #2
    Hard to say without seeing the relevant code. So you have confirmed your button is hooked up correctly but obviously you need to make sure your connection back to the movie view is good too.
     
  3. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #3
    And you need to make sure your hard coded path is valid, and the QTMovie is created and is valid, etc...

    When in doubt, post your code ;)
     
  4. zabbadu thread starter macrumors newbie

    Joined:
    Jul 27, 2007
    #4
    A funny thing happened on the way to the forum..

    Well,
    First, I'd like to thank you for responding.. I'm sure I'm not the only one to express appreciation for folks willing to help out others on this site..

    Second, oops.

    I'm not sure why this happens, but lesson learned.. The movie file I downloaded was a preview clip from apple.com's trailer page. When I copied the url for downloading, it was a .mov file. And when it arrived in the filesystem, it had a .mov.qt file extension. I removed the .qt extension & had been trying to play around with that file.

    Today, after reading the posts replied to my question, I moved a different file to the desktop [that's the location I hardcoded], one with a .mov extension. Built & ran the project, clicked the play button & it played!

    So, I believe my initial confusion was warranted, since it seemed weird that the files would play in a DocBasedApp, but wouldn't [due to my own error] in a nonDocBasedApp.

    Interesting!

    Anyway, thanks again for posting responses!
     

Share This Page