Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Autoplay RTSP stream?



Hi

I'm currently trying to play a RTSP stream when my program starts. When i use: m.setRate(1); the player is dead, cant do anything. It works fine if I use a .mov over HTTP but not a RTSP. It seems to work sometimes if i set the rate to 0.1, i have no idéa why it just work sometimes. I've been looking on the mailing list for question about this but I can't find anything that solves my problem.

This is my code:

import java.awt.Component;

import javax.swing.JFrame;

import quicktime.Errors;
import quicktime.QTException;
import quicktime.QTSession;
import quicktime.app.view.QTComponent;
import quicktime.app.view.QTFactory;
import quicktime.std.StdQTConstants ;
import quicktime.std.movies.Movie;
import quicktime.std.movies.MovieController;
import quicktime.std.movies.media.DataRef;

public class QTFrameworkTest extends JFrame implements Errors {

    private static Movie m;
    private MovieController mc;
    private QTComponent qtc = null;
 
    QTFrameworkTest(String title) {
        try {
            createNewMovieFromURL("rtsp://147.214.171.166/bigbrother.sdp");
           
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }

    public static void main(String[] args) {
        try {
            QTSession.open();

            QTFrameworkTest pm = new QTFrameworkTest("QT Test");
            pm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            pm.pack();
            pm.setVisible(true);
            pm.toFront();
 
            m.setRate(1.0f);
           
        } catch (QTException e) {
            //e.printStackTrace();
            QTSession.close();
        }
    }

    public void createNewMovieFromURL(String theURL) {
        try {
            DataRef urlMovie = new DataRef(theURL);
           
            m = Movie.fromDataRef(urlMovie, StdQTConstants.newMovieActive);
           
            // create the movie controller
            mc = new MovieController(m);
            if (qtc == null) {
                qtc = QTFactory.makeQTComponent(mc);
                add((Component) qtc);
            } else {
                qtc.setMovieController(mc);
                System.out.println("SetMvieController");
            }

            m.setActive(true);
        } catch (QTException err) {
            //err.printStackTrace();
        }
    }
}

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-java mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-java/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.