quicktime-java

[Prev] Thread [Next]  |  [Prev] Date [Next]

Stop audio playback while streaming / broadcast Jan Pawel Wisniewski Fri Oct 10 16:01:13 2008

Hi.
I am writing small broadcast based on LittleBroadcast from Streaming quicktime 
with java 
http://www.onjava.com/pub/a/onjava/2005/01/12/strmng_qtj.html 
by Chris Adamson.

Problem is that recorder audio is presented on speakers and causes unpleasant 
feedback - you know, this squeaky sound.

I am out of ideas how to switch that off without switching of speakers 
absolutely. 

I attach part of code, the rest is on 
http://www.onjava.com/pub/a/onjava/2005/01/12/strmng_qtj.html 

----------------------------------------------------------
public class LittleBroadcast extends Tasking implements ActionListener {
        Presentation pres;
        boolean broadcasting = false;
    int BROADCAST_WIDTH = 176;
    int BROADCAST_HEIGHT = 144;
    Button startStopButton;
    Button configButton;
    int presenterTimeScale = 600;
    
        public LittleBroadcast() throws QTException {
                String filename = "broadcast.sdp";
                QTFile file = new QTFile(new File(filename));
                MediaParams mediaParams = new MediaParams();
        mediaParams.setWidth(BROADCAST_WIDTH);
        mediaParams.setHeight(BROADCAST_HEIGHT);
        QDGraphics myGWorld = new QDGraphics(new QDRect(BROADCAST_WIDTH, 
BROADCAST_HEIGHT));
        mediaParams.setGWorld(myGWorld);
                PresParams presParams = new PresParams(presenterTimeScale, 
QTSConstants.kQTSSendMediaFlag | 
                                QTSConstants.kQTSAutoModeFlag | 
QTSConstants.kQTSDontShowStatusFlag, mediaParams);
                pres = Presentation.fromFile(file, presParams);
                broadcasting = false;
                setWindow(); // GUI setup 
    }
    
    public synchronized final void task() throws QTException {
                pres.idle(null);
        }
    
    private void setWindow(){
        startStopButton = new Button("Start");
        configButton = new Button("Configure");
        startStopButton.addActionListener(this);
        configButton.addActionListener(this);
        Frame monitorFrame = new Frame("QTJ Streaming");
        monitorFrame.setLayout(new BorderLayout());
        Panel buttonPanel = new Panel();
        buttonPanel.add(startStopButton);
        buttonPanel.add(configButton);
        monitorFrame.add(buttonPanel, BorderLayout.SOUTH);
        monitorFrame.pack();
        monitorFrame.setVisible(true);
    }
    
    public void actionPerformed (ActionEvent ae) {
        try {
            if (ae.getSource() == startStopButton) {
                if (broadcasting) {
                    pres.stop();
                    stopTasking();
                    broadcasting = false;
                    startStopButton.setLabel ("Start");
                } else {
                        pres.start();
                    startTasking();
                    broadcasting = true;
                    startStopButton.setLabel ("Stop");
                }
            } else if (ae.getSource() == configButton) {
                new SettingsDialog (pres);
            }
        } catch (QTException qte) {
            qte.printStackTrace();
        }
    }
        
        public static void main (String[] args) throws QTException {
                QTSession.open();
            new LittleBroadcast();
        }
}
----------
Broadcast file:
v=0
o=- 2 723101178 IN IP4 127.0.0.0
s=QuickTime
t=0 0
a=range:npt=now-
m=audio 5432 RTP/AVP 96
c=IN IP4 192.168.1.22  // change PI to station you broadcast to
b=AS:16
a=rtpmap:96 mpeg4-generic/8000/2
a=fmtp:96 
profile-level-id=15;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1590
a=mpeg4-esid:101
m=video 5434 RTP/AVP 97
c=IN IP4 192.168.1.22
a=rtpmap:97 X-QT/90000
a=cliprect:0,0,180,240
a=framesize:97 240-180
a=x-bufferdelay:0.15


------------------------------------
Thanks for all kind of help,

Jan



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-java mailing list      ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-java/alexiscircle%40gmail.com

This email sent to [EMAIL PROTECTED]