Question

In short, I want to create a simple video player which can play some major video formats like quicktime *.mov, for example. What I need is:

  • video playback (at least the most major formats would be great)
  • play, pause
  • need information about where the movie currently is (how many seconds passed, or how much percent)

I'm targeting the mac, for the beginning. So the preferred technology is Cocoa and Objective-C. But if there's just nothing for that, I could also imagine to do something with Java. Any idea?

Was it helpful?

Solution

QTKit is the (built-in) Objective-C framework for developing with QuickTime. It includes QTMovieView and QTMovieLayer, an NSView and CALayer subclass respectively for playing any content that QuickTime understands. Simple playback controls can optionally be provided by these controls for free. Both can be used from Interface Builder, making a media app an almost zero-code affair. The QuickTime Programming Guide will get you started.

You should also check the QTKitPlayer sample code. It can do everything you describe and shows how to integrate all of the QTKit components for a playback-only application (QTKit also supports media capture and editing).

OTHER TIPS

You can use QuickTime for Java

It's very easy to use.

Here's a snippet:

        QTSession.open();
        String url = "http://......mov";
        DataRef dRef = new DataRef(url);
        Movie mov = Movie.fromDataRef (dRef, StdQTConstants.newMovieActive);
        MoviePlayer player = new MoviePlayer(mov);
        mov.start();
        JComponent qtPlayer = QTFactory.makeQTJComponent(player).asJComponent();

The snipped was taken from the examples from: Timing Framework written by Chet Haase

That sample ( the one from the Timing Framework ) looks like this:

Java quicktime http://img41.imageshack.us/img41/7268/capturadepantalla200909p.png

If you want to use Java then Java Media Framework or it's open source analog Freedom For Media in Java, will do the job. FMJ has native binding to DirectShow, QuickTime For Java and Gstreamer. It will do everything you need plus a little bit more. And you will not need to worry about which format you're playing.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top