[转载]jmf实现视频通话
(2012-11-26 20:38:53)
标签:
转载 |
看看原文
原文地址:jmf实现视频通话作者:tianya_feixue
- 第一个类::::
- package
vidioPlay; -
- import
java.awt.Dimension; - import
java.io.IOException; - import
java.net.InetAddress; - import
java.util.Vector; -
- import
javax.media.CaptureDeviceInfo; - import
javax.media.Codec; - import
javax.media.Control; - import
javax.media.Controller; - import
javax.media.ControllerClosedEvent; - import
javax.media.ControllerEvent; - import
javax.media.ControllerListener; - import
javax.media.Format; - import
javax.media.IncompatibleSourceExcept ion; - import
javax.media.Manager; - import
javax.media.MediaLocator; - import
javax.media.NoProcessorException; - import
javax.media.Owned; - import
javax.media.Player; - import
javax.media.Processor; - import
javax.media.cdm.CaptureDeviceManager; - import
javax.media.control.QualityControl; - import
javax.media.control.TrackControl; - import
javax.media.format.AudioFormat; - import
javax.media.format.VideoFormat; - import
javax.media.protocol.ContentDescriptor; - import
javax.media.protocol.DataSource; - import
javax.media.protocol.PushBufferDataSource; - import
javax.media.protocol.PushBufferStream; - import
javax.media.protocol.SourceCloneable; - import
javax.media.rtp.RTPManager; - import
javax.media.rtp.SendStream; - import
javax.media.rtp.SessionAddress; - import
javax.media.rtp.rtcp.SourceDescription; - import
javax.swing.JFrame; -
- public
class MediaTransmit { -
-
String ipAddress; -
int portBase; -
MediaLocator null,audioLocator = vedioLocator null;= -
Processor null;audioProcessor = -
Processor null;videoProcessor = -
DataSource null,audioDataLocal = videoDataLocal null;= -
DataSource null,audioDataOutput = videoDataOutput null;= -
RTPManager rtpMgrs[]; -
DataSource null;mediaData = -
DataSource null;dataLocalClone = -
-
PlayPane playFrame; -
-
MediaTransmit(String ipAddress, String pb) { -
= ipAddress; -
Integer integer = Integer.valueOf(pb); -
(integer null)!= { -
= integer.intValue(); -
} -
///////////////////////////////////////////// -
playFrame = PlayPane(); -
JFrame jf = JFrame( "视频实例"); -
-
jf.add(playFrame); -
jf.pack(); -
jf.setLocationRelativeTo( -
jf.setDefaultCloseOperation ( -
jf.setVisible( -
//////////////////////////////////////////// -
Vector<CaptureDeviceInfo> video = CaptureDeviceManager -
.getDeviceList( VideoFormat( null)); -
Vector<CaptureDeviceInfo> audio = CaptureDeviceManager -
.getDeviceList( AudioFormat(AudioFormat.LINEAR, 44100,16, 2)); -
MediaLocator mediaLocator = new -
MediaLocator("file:/C:/纯音乐 - 忧伤还是快乐.mp3"); -
(audio null!= && 0)audio.size() > { -
audioLocator = ((CaptureDeviceInfo) audio.get( -
((audioProcessor null)= createProcessor(audioLocator)) != { -
audioDataLocal = mediaData; -
audioDataOutput = audioProcessor.getDataOutput(); -
} -
} { -
System.out.println( -
} -
///////////////////////////////////////////////////////// -
(video null!= && 0)video.size() > { -
vedioLocator = ((CaptureDeviceInfo) video.get( -
((videoProcessor null)= createProcessor(vedioLocator)) != { -
videoDataLocal = mediaData; -
videoDataOutput = videoProcessor.getDataOutput(); -
} -
} { -
System.out.println( -
} -
///////////////////////////////////////////////////////// -
DataSource[] newdataSources = DataSource[ 2]; -
dataSources[ = audioDataLocal; -
dataSources[ = videoDataLocal; -
{ -
DataSource dsLocal = Manager.createMergingDataSource(dataSources); -
playFrame.localPlay(dsLocal); -
} (IncompatibleSourceExcept ion e) { -
e.printStackTrace(); -
-
} -
////////////////////////////////////////////////远程传输 -
dataSources[ = audioDataOutput; -
dataSources[ = videoDataOutput; -
-
{ -
DataSource dsoutput = Manager.createMergingDataSource(dataSources); -
createTransmitter(dsoutput); -
} (IncompatibleSourceExcept ion e) { -
e.printStackTrace(); -
-
} -
audioProcessor.start(); -
videoProcessor.start(); -
} -
-
Processor createProcessor(MediaLocator locator) { -
Processor processor = -
(locator null)== -
null; -
通过设备定位器得到数据源, -
{ -
mediaData = Manager.createDataSource(locator); -
创建可克隆数据源 -
mediaData = Manager.createCloneableDataSourc e(mediaData); -
克隆数据源,用于传输到远程 -
dataLocalClone = ((SourceCloneable) mediaData).createClone(); -
} (Exception e) { -
e.printStackTrace(); -
null; -
} -
{ -
processor = javax.media.Manager.createProcessor(dataLocalClone); -
-
} (NoProcessorException npe) { -
npe.printStackTrace(); -
null; -
} (IOException ioe) { -
null; -
} -
result = waitForState(processor, Processor.Configured); -
(result false)== -
null; -
-
TrackControl[] tracks = processor.getTrackControls(); -
(tracks null== || 1)tracks.length < -
null; -
ContentDescriptor cd = ContentDescriptor(ContentDescriptor.RAW_RTP); -
processor.setContentDescriptor(cd); -
Format supportedFormats[]; -
Format chosen; -
atLeastOneTrack false;= -
( inti 0;= i < tracks.length; i++) { -
(tracks[i].isEnabled()) { -
supportedFormats = tracks[i].getSupportedFormats(); -
(supportedFormats.length 0)> { -
(supportedFormats[ 0]instanceof VideoFormat) { -
chosen = checkForVideoSizes(tracks[i].getFormat(), -
supportedFormats[ -
} -
chosen = supportedFormats[ -
tracks[i].setFormat(chosen); -
System.err -
.println( " + "i + is );set to transmit as:" -
System.err.println( " + chosen); -
atLeastOneTrack = -
} -
tracks[i].setEnabled( -
} -
tracks[i].setEnabled( -
} -
-
(!atLeastOneTrack) -
null; -
result = waitForState(processor, Controller.Realized); -
(result false)== -
null; -
setJPEGQuality(processor, -
-
processor; -
} -
-
String createTransmitter(DataSource dataOutput) { -
PushBufferDataSource pbds = (PushBufferDataSource) dataOutput; -
PushBufferStream pbss[] = pbds.getStreams(); -
System.out.println( + pbss.length); -
rtpMgrs = RTPManager[pbss.length]; -
SendStream sendStream; -
port; -
SourceDescription srcDesList[]; -
-
( inti 0;= i < pbss.length; i++) { -
{ -
rtpMgrs[i] = RTPManager.newInstance(); -
-
port = portBase + * i; -
SessionAddress localAddr = SessionAddress( -
InetAddress.getLocalHost(), port); -
SessionAddress destAddr = SessionAddress( -
InetAddress.getByName(ipAddress), port); -
rtpMgrs[i].initialize(localAddr); -
rtpMgrs[i].addTarget(destAddr); -
System.out.println( RTP session: " -
+ InetAddress.getLocalHost() + " + port); -
sendStream = rtpMgrs[i].createSendStream(dataOutput, i); -
sendStream.start(); -
} (Exception e) { -
e.printStackTrace(); -
e.getMessage(); -
} -
} -
-
null; -
} -
Format checkForVideoSizes(Format original, Format supported) { -
-
width, height; -
Dimension size = ((VideoFormat) original).getSize(); -
Format jpegFmt = Format(VideoFormat.JPEG_RTP); -
Format h263Fmt = Format(VideoFormat.H263_RTP); -
-
(supported.matches(jpegFmt)) { -
width = (size.width % == 0? size.width -
: ( (size.width 8)/ * 8); -
height = (size.height % == 0? size.height -
: ( (size.height 8)/ * 8); -
} if (supported.matches(h263Fmt)) { -
(size.width 128)< { -
width = -
height = -
} if (size.width 176)< { -
width = -
height = -
} { -
width = -
height = -
} -
} { -
supported; -
} -
-
( newVideoFormat( null,new Dimension(width, height), -
Format.NOT_SPECIFIED, Format.NOT_SPECIFIED)) -
.intersects(supported); -
} -
setJPEGQuality(Player floatp, val) { -
-
Control cs[] = p.getControls(); -
QualityControl qc = -
VideoFormat jpegFmt = VideoFormat(VideoFormat.JPEG); -
( inti 0;= i < cs.length; i++) { -
-
(cs[i] instanceofQualityControl instanceof&& cs[i] Owned) { -
Object owner = ((Owned) cs[i]).getOwner(); -
(owner instanceofCodec) { -
Format fmts[] = ((Codec) owner) -
.getSupportedOutputFormat s( -
( intj 0;= j < fmts.length; j++) { -
(fmts[j].matches(jpegFmt)) { -
qc = (QualityControl) cs[i]; -
qc.setQuality(val); -
System.err.println( Setting quality to " + val -
+ on " + qc); -
-
} -
} -
} -
(qc null)!= -
-
} -
} -
} -
Integer newstateLock = Integer( 0); -
boolean failed false;= -
-
Integer getStateLock() { -
stateLock; -
} -
-
setFailed() { -
failed = -
} -
-
synchronized boolean waitForState(Processor intp, state) { -
p.addControllerListener( StateListener()); -
failed = -
(state == Processor.Configured) { -
p.configure(); -
} if (state == Processor.Realized) { -
p.realize(); -
} -
(p.getState() < state && !failed) { -
(getStateLock()) { -
{ -
getStateLock().wait(); -
} (InterruptedException ie) { -
false; -
} -
} -
} -
-
(failed) -
false; -
-
true; -
} -
StateListener implementsControllerListener { -
-
void controllerUpdate(ControllerEvent ce) { -
-
(ce instanceofControllerClosedEvent) -
setFailed(); -
-
(ce instanceofControllerEvent) { -
(getStateLock()) { -
getStateLock().notifyAll(); -
} -
} -
} -
} -
static void main(String[] args) { -
String[] strs = { "9994" }; -
MediaTransmit(strs[ 0],strs[ 1]); -
} - }
第二个类:::
- package
vidioPlay; -
- import
java.awt.BorderLayout; - import
java.awt.Component; - import
java.awt.Dimension; - import
java.awt.Panel; - import
java.net.InetAddress; - import
java.util.Vector; -
- import
javax.media.ControllerErrorEvent; - import
javax.media.ControllerEvent; - import
javax.media.ControllerListener; - import
javax.media.Player; - import
javax.media.RealizeCompleteEvent; - import
javax.media.bean.playerbean.MediaPlayer; - import
javax.media.control.BufferControl; - import
javax.media.format.FormatChangeEvent; - import
javax.media.protocol.DataSource; - import
javax.media.rtp.Participant; - import
javax.media.rtp.RTPControl; - import
javax.media.rtp.RTPManager; - import
javax.media.rtp.ReceiveStream; - import
javax.media.rtp.ReceiveStreamListener; - import
javax.media.rtp.SessionListener; - import
javax.media.rtp.event.ByeEvent; - import
javax.media.rtp.event.NewParticipantEvent; - import
javax.media.rtp.event.NewReceiveStreamEvent; - import
javax.media.rtp.event.ReceiveStreamEvent; - import
javax.media.rtp.event.RemotePayloadChangeEvent ; - import
javax.media.rtp.event.SessionEvent; - import
javax.media.rtp.event.StreamMappedEvent; - import
javax.swing.JFrame; -
- import
net.sf.fmj.media.rtp.RTPSocketAdapter; -
-
- public
class MediaReceive implementsReceiveStreamListener, SessionListener, -
ControllerListener { -
String sessions[] = -
RTPManager mgrs[] = -
-
dataReceived false;= -
Object dataSync = Object(); -
PlayPane playFrame; -
-
MediaReceive(String sessions[]) { -
= sessions; -
} -
-
void initialize() { -
playFrame = PlayPane(); -
JFrame jf = JFrame( "视频实例"); -
-
jf.add(playFrame); -
jf.pack(); -
jf.setLocationRelativeTo( -
jf.setDefaultCloseOperation ( -
jf.setVisible( -
{ -
每一个session对应一个RTPManager -
mgrs = RTPManager[sessions.length]; -
创建播放窗口的向量vector -
-
SessionLabel session = -
-
Open the RTP sessions. -
针对每一个会话对象进行ip、port和ttl的解析 -
( inti 0;= i < sessions.length; i++) { -
-
Parse the session addresses. -
进行会话对象的解析,得到ip、port和ttl -
{ -
session = SessionLabel(sessions[i]); -
} (IllegalArgumentException e) { -
System.err -
.println( to parse the session address given: " -
+ sessions[i]); -
return false; -
} -
-
System.err.println( - Open RTP session for: addr: " -
+ session.addr + port: " + "session.port + ttl: " -
+ session.ttl); -
这对本条会话对象创建RTPManager -
mgrs[i] = (RTPManager) RTPManager.newInstance(); -
mgrs[i].addSessionListener( -
mgrs[i].addReceiveStreamListener ( -
-
Initialize the RTPManager with the RTPSocketAdapter -
将本机ip和端口号加入RTP会话管理 -
System.out.println( + session.addr); -
mgrs[i].initialize( RTPSocketAdapter(InetAddress -
.getByName(session.addr), session.port, session.ttl)); -
BufferControl bc = (BufferControl) mgrs[i] -
.getControl( -
(bc null)!= -
bc.setBufferLength( -
} -
-
} (Exception e) { -
e.printStackTrace(); -
} -
} -
-
-
void close() { -
-
close the RTP session. -
( inti 0;= i < mgrs.length; i++) { -
(mgrs[i] null)!= { -
mgrs[i].removeTargets( session );from AVReceive3" -
mgrs[i].dispose(); -
mgrs[i] = -
} -
} -
} -
-
-
-
synchronized void update(SessionEvent evt) { -
-
(evt instanceofNewParticipantEvent) { -
Participant p = ((NewParticipantEvent) evt).getParticipant(); -
System.err.println( - A new participant had just joined: " + p); -
} -
} -
-
-
synchronized void update(ReceiveStreamEvent evt) { -
-
RTPManager mgr = (RTPManager) evt.getSource(); -
Participant participant = evt.getParticipant(); could be null. -
ReceiveStream stream = evt.getReceiveStream(); could be null. -
-
(evt instanceofRemotePayloadChangeEvent ) { -
-
System.err.println( - Received an RTP PayloadChangeEvent." -
System.err.println( cannot );handle payload change." -
System.exit(0); -
-
} -
-
if (evt instanceofNewReceiveStreamEvent) { -
System.out.println( instanceof );NewReceiveStreamEvent" -
{ -
stream = ((NewReceiveStreamEvent) evt).getReceiveStream(); -
DataSource data = stream.getDataSource(); -
-
Find out the formats. -
RTPControl ctl = (RTPControl) data -
.getControl( -
(ctl null)!= { -
System.err.println( - Recevied new RTP stream: " -
+ ctl.getFormat()); -
} -
System.err.println( - Recevied new RTP stream" -
-
(participant null)== -
System.err -
.println( The sender of this stream had yet to be identified." -
{ -
System.err.println( The stream comes from: " -
+ participant.getCNAME()); -
} -
-
create a player by passing datasource to the Media Manager -
Thread() { -
void run() { -
playFrame.remotePlay(data); -
} -
}.start(); -
Player p = javax.media.Manager.createPlayer(data); -
if (p == null) -
return; -
-
p.addControllerListener(this); -
p.realize(); -
PlayerWindow pw = new PlayerWindow(p, stream); -
playerWindows.addElement(pw); -
-
Notify intialize() that a new stream had arrived. -
(dataSync) { -
dataReceived = -
dataSync.notifyAll(); -
} -
-
} (Exception e) { -
System.err.println( exception " -
+ e.getMessage()); -
-
} -
-
} -
-
if (evt instanceofStreamMappedEvent) { -
System.out.println( instanceof );StreamMappedEvent" -
stream = ((StreamMappedEvent) evt).getReceiveStream(); -
(stream null!= && null)stream.getDataSource() != { -
DataSource ds = stream.getDataSource(); -
Find out the formats. -
RTPControl ctl = (RTPControl) ds -
.getControl( -
System.err.println( - The previously unidentified stream " -
(ctl null)!= -
System.err.println( " + ctl.getFormat()); -
System.err.println( had now been identified as sent by: " -
+ participant.getCNAME()); -
System.out.println( == null" + null));(ds == -
} -
} -
-
if (evt instanceofByeEvent) { -
-
System.err.println( - Got "bye" from: " -
+ participant.getCNAME()); -
-
} -
-
} -
-
-
synchronized void controllerUpdate(ControllerEvent ce) { -
-
Player p = (Player) ce.getSourceController(); -
-
(p null)== -
-
-
} -
-
-
SessionLabel { -
-
String null;addr = -
int port; -
int ttl 1;= -
-
SessionLabel(String session) IllegalArgumentException { -
-
off; -
String portStr = ttlStr null;= -
-
(session null!= && 0)session.length() > { -
(session.length() 1> && 0)session.charAt( == '/'){ -
session = session.substring( -
} -
off = session.indexOf( -
(off 1)== - { -
(!session.equals( "")) -
addr = session; -
} { -
addr = session.substring( off); -
session = session.substring(off + -
off = session.indexOf( -
(off 1)== - { -
(!session.equals( "")) -
portStr = session; -
} { -
portStr = session.substring( off); -
session = session.substring(off + -
off = session.indexOf( -
(off 1)== - { -
(!session.equals( "")) -
ttlStr = session; -
} { -
ttlStr = session.substring( off); -
} -
} -
} -
} -
-
(addr null)== -
new IllegalArgumentException (); -
-
(portStr null)!= { -
{ -
Integer integer = Integer.valueOf(portStr); -
(integer null)!= -
port = integer.intValue(); -
} (Throwable t) { -
new IllegalArgumentException (); -
} -
} -
new IllegalArgumentException (); -
-
(ttlStr null)!= { -
{ -
Integer integer = Integer.valueOf(ttlStr); -
(integer null)!= -
ttl = integer.intValue(); -
} (Throwable t) { -
new IllegalArgumentException (); -
} -
} -
} -
} -
-
-
static void main(String argv[]) { -
String[] strs = { "125.221.165.126/9996" }; -
MediaReceive avReceive = MediaReceive(strs); -
avReceive.initialize(); -
-
} - }
第三个类::
- package
vidioPlay; -
- import
java.awt.BorderLayout; - import
java.awt.Color; - import
java.awt.Component; - import
java.awt.Dimension; - import
java.awt.FlowLayout; - import
java.awt.Graphics; - import
java.awt.Rectangle; - import
java.awt.event.ActionEvent; - import
java.awt.event.ActionListener; - import
java.io.IOException; -
- import
javax.media.ControllerEvent; - import
javax.media.ControllerListener; - import
javax.media.DataSink; - import
javax.media.NoPlayerException; - import
javax.media.Player; - import
javax.media.Processor; - import
javax.media.protocol.DataSource; - import
javax.swing.ImageIcon; - import
javax.swing.JButton; - import
javax.swing.JPanel; -
- public
class PlayPane extendsJPanel { -
ImageIcon newvideoReqIcon = ImageIcon( "videoReq.jpg"); -
ImageIcon newVideolocalIcon = ImageIcon( "localVideo.jpg"); -
boolean isViewBigPlaying false;= -
boolean isViewSmallPlaying false;= -
JPanel viewBigPane; -
JPanel viewSmallPane; -
JPanel controlPane; -
-
JButton closeButton; -
-
boolean localPlay false;= -
boolean remotePlay false;= -
-
DataSource localData; -
DataSource remoteData; -
-
boolean isViewRun true;= -
boolean isShow true;= -
-
Player null;localPlayer = -
Player null;remotePlayer = -
-
Processor null;videotapeProcessor = -
Player null;videotapePlayer = -
DataSink videotapeFileWriter; -
-
PlayPane() { -
BorderLayout()); -
视图面板 -
viewBigPane = JPanel() { -
void paintComponent(Graphics g) { -
-
(!isViewBigPlaying) { -
g.drawImage(videoReqIcon.getImage(), 1, -
videoReqIcon.getIconWidth(), -
videoReqIcon.getIconHeight(), -
-
g.drawRect(getSmallPlayRec().x - -
getSmallPlayRec().y - -
getSmallPlayRec().width + -
getSmallPlayRec().height + -
} { -
-
} -
} -
}; -
viewBigPane.setBackground(Color.black); -
BorderLayout.CENTER); -
viewBigPane.setLayout( -
/////////////////////////////// -
viewSmallPane = JPanel() { -
void paintComponent(Graphics g) { -
-
(!isViewSmallPlaying) { -
g.drawImage(VideolocalIcon.getImage(), 0, null); -
} { -
-
} -
} -
}; -
viewSmallPane.setBounds(getSmallPlayRec()); -
viewBigPane.add(viewSmallPane); -
viewSmallPane.setLayout( -
-
控制面板组件 -
closeButton = JButton( "挂断"); -
controlPane = JPanel(); -
controlPane.setLayout( FlowLayout(FlowLayout.RIGHT, 0,0)); -
controlPane.add(closeButton); -
BorderLayout.SOUTH); -
closeButton.addActionListener( ActionListener() { -
void actionPerformed(ActionEvent e) { -
(localPlayer null)!= { -
localPlayer.stop(); -
} -
(remotePlayer null)!= { -
remotePlayer.stop(); -
} -
(videotapePlayer null)!= { -
videotapePlayer.stop(); -
} -
(videotapeProcessor null)!= { -
videotapeProcessor.stop(); -
} -
(videotapeFileWriter null)!= { -
{ -
videotapeFileWriter.stop(); -
videotapeFileWriter.close(); -
} (IOException e1) { -
} -
} -
} -
-
}); -
this.setMinimumSize(new Dimension(videoReqIcon.getIconWidth()+2, -
241)); -
this.setPreferredSize(new Dimension(videoReqIcon.getIconWidth()+2, -
241)); -
-
} -
-
Dimension getMinimumSize() { -
System.out -
.println( + controlPane.getHeight()); -
new Dimension(videoReqIcon.getIconWidth() 2,+ -
videoReqIcon.getIconHeight() + controlPane.getHeight()); -
} -
-
Dimension getPreferredSize() { -
System.out -
.println( + controlPane.getHeight()); -
new Dimension(videoReqIcon.getIconWidth() 2,+ -
videoReqIcon.getIconHeight() -
+ controlPane.getPreferredSize().height); -
} -
-
void localPlay(DataSource dataSource) { -
-
{ -
localPlayer = javax.media.Manager.createPlayer(dataSource); -
-
localPlayer.addControllerListener( ControllerListener() { -
void controllerUpdate(ControllerEvent e) { -
-
(e instanceofjavax.media.RealizeCompleteEvent) { -
Component comp = -
comp = localPlayer.getVisualComponent(); -
(comp null)!= { -
将可视容器加到窗体上 -
comp.setBounds( 0, VideolocalIcon.getIconWidth(), -
VideolocalIcon.getIconHeight()); -
viewSmallPane.add(comp); -
} -
viewBigPane.validate(); -
} -
} -
}); -
localPlayer.start(); -
localPlay = -
} (NoPlayerException e1) { -
e1.printStackTrace(); -
} (IOException e1) { -
e1.printStackTrace(); -
} -
} -
-
Rectangle getSmallPlayRec() { -
bigShowWidth = videoReqIcon.getIconWidth(); -
bigShowHeight = videoReqIcon.getIconHeight(); -
smallShowWidth = VideolocalIcon.getIconWidth(); -
smallShowHeight = VideolocalIcon.getIconHeight(); -
new Rectangle(bigShowWidth 2,- smallShowWidth - bigShowHeight -
- smallShowHeight - smallShowWidth, smallShowHeight); -
} -
-
void remotePlay(DataSource dataSource) { -
-
remotePlay = -
{ -
remotePlayer = javax.media.Manager.createPlayer(dataSource); -
-
remotePlayer.addControllerListener( ControllerListener() { -
void controllerUpdate(ControllerEvent e) { -
-
(e instanceofjavax.media.RealizeCompleteEvent) { -
Component comp; -
((comp null)= remotePlayer.getVisualComponent()) != { -
将可视容器加到窗体上 -
comp.setBounds( 1, videoReqIcon.getIconWidth(), -
videoReqIcon.getIconHeight()); -
viewBigPane.add(comp); -
} -
viewBigPane.validate(); -
} -
} -
}); -
remotePlayer.start(); -
remotePlay = -
} (NoPlayerException e1) { -
e1.printStackTrace(); -
} (IOException e1) { -
e1.printStackTrace(); -
} -
} -
-
void closeViewUI() { -
isShow = -
} -
-
boolean isViewRunning() { -
isViewRun; -
} -
-
boolean isShowing() { -
isShow; -
} -
-
void localReady() { -
localPlay = -
} -
-
void remoteReady() { -
remotePlay = -
} -
-
boolean isRemotePlay() { -
remotePlay; -
} -
-
void setRemotePlay( booleanremotePlay) { -
= remotePlay; -
} -
-
DataSource getRemoteData() { -
remoteData; -
} -
-
void setRemoteData(DataSource remoteData) { -
= remoteData; -
} -
-
boolean isLocalPlay() { -
localPlay; -
} -
-
void setLocalPlay( booleanlocalPlay) { -
= localPlay; -
} -
-
DataSource getLocalData() { -
localData; -
} -
-
void setLocalData(DataSource localData) { -
= localData; -
} -
- }
运行的时候先运行MediaTransmit类,后运行MediaReceive类
前一篇:欢迎您在新浪博客安家