January 2005
Intermediate to advanced
256 pages
6h 34m
English
Along with loading movies from disk, QuickTime can also load them from URLs, and is pretty smart about network latency.
Example 2-6 shows a totally new class,
BasicQTURLController.java. This is a significant
rethinking of the earlier BasicQTController class.
This example creates a GUI from an empty
“dummy” movie, then asks the user
for a URL, gets a Movie from that, and replaces
the dummy movie. By getting the movie last, it tempts fate to see how
well QTJ can deal with loading a movie over the network.
Example 2-6. Loading and playing a movie from a URL
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 com.oreilly.qtjnotebook.ch01.QTSessionCheck; import java.awt.*; 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 ...Read now
Unlock full access