来自Android的流媒体视频

时间:2010-11-11 14:05:52

标签: android camera video-streaming rtp

我正在尝试从Android手机中传输视频,应该在媒体播放器中观看。 我一直在关注http://www.mattakis.com/blog/kisg/20090708/broadcasting-video-with-android-without-writing-to-the-file-system,因为它发送原始文件数据而不是可流式格式,这似乎是一个死胡同。

然后我尝试使用SipDroid中的一些代码,更具体; VideoCamera.java,RtpPacket.java和RtpSocket.java的部分,它们在UDP上提供流,但是这些在mplayer中无法播放(无法检测编解码器)。 Wireshark告诉它它是一个UDP数据包而不是RTP数据包,所以可能会丢失某些东西?

我有点卡住了,你有什么建议如何超越这个颠簸?

2 个答案:

答案 0 :(得分:2)

右键单击Wireshark中的数据包,然后选择解码为选项。然后选择 rtp 。现在,您可以在Wireshark中看到RTP数据包。

答案 1 :(得分:-7)

我认为您可以从以下代码段中找到解决方案:

package com.Videoplaying;

import android.app.Activity;  
import android.net.Uri;  
import android.os.Bundle;  
import android.widget.MediaController;  
import android.widget.VideoView; 

public class Video extends Activity {  
private MediaController mc;

/** Called when the activity is first created. */  
  @Override  
  public void onCreate(Bundle savedInstanceState) {  
  super.onCreate(savedInstanceState);  
  setContentView(R.layout.main);  
  VideoView vd = (VideoView) findViewById(R.id.VideoView);  
  String LINK = "http://daily3gp.com/vids/747.3gp";  
  mc = new MediaController(this);  
  mc.setMediaPlayer(vd);  
  Uri uri = Uri.parse(LINK);  
  vd.setMediaController(mc);  
  vd.setVideoURI(uri);  
  vd.requestFocus();  
  vd.start();  
 }  
}