FileDocCategorySizeDatePackage
BasicQTURLController.javaAPI DocExample2500Wed Nov 10 12:37:32 GMT 2004com.oreilly.qtjnotebook.ch02

BasicQTURLController.java

/*

Copyright (c) 2004, Chris Adamson

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

*/
package com.oreilly.qtjnotebook.ch02;

import quicktime.*;
import quicktime.std.*;
import quicktime.app.view.*;
import quicktime.std.movies.*;
import quicktime.std.movies.media.*;
import quicktime.io.*;

import java.awt.*;

import com.oreilly.qtjnotebook.ch01.QTSessionCheck;

public class BasicQTURLController extends Frame {

    QTComponent qc;

    public BasicQTURLController () throws QTException {
        super ("Basic QT DataRef/Controller");
        Movie dummyMovie = new Movie();
        qc = QTFactory.makeQTComponent (dummyMovie);
        Component c = qc.asComponent();
        add (c);
        pack();
    }

    public static void main (String[] args) {
        try {
            QTSessionCheck.check();
            BasicQTURLController f = new BasicQTURLController ();
            String url =
                javax.swing.JOptionPane.showInputDialog (f,
                                                         "Enter URL");
            DataRef dr = new DataRef (url);
            Movie m = Movie.fromDataRef (dr,
                                         StdQTConstants.newMovieActive);
            MovieController mc = new MovieController (m);
            f.qc.setMovieController (mc);
            f.setVisible(true);
            f.pack();
            m.prePreroll(0, 1.0f);
            m.preroll(0, 1.0f);
            m.start();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


}