开发者

Streaming Video From Android

开发者 https://www.devze.com 2023-01-24 08:17 出处:网络
I\'m trying to stream video from the Android phone,开发者_StackOverflow which should be watched in an mediaplayer.

I'm trying to stream video from the Android phone,开发者_StackOverflow which should be watched in an mediaplayer. I've been looking at http://www.mattakis.com/blog/kisg/20090708/broadcasting-video-with-android-without-writing-to-the-file-system which seems to be a dead end since it send the raw file data, and not a streamable format.

Then I tried using some code from SipDroid, more specific; parts of VideoCamera.java, RtpPacket.java and RtpSocket.java, which gives a stream on UDP, however these is not playable in i.e. mplayer(can't detect the codec). Wireshark tells that it is a UDP packet and not a RTP packet so something might be missing?

I'm kind'a stuck, have you any suggestions how to get past this bump?


Right click on the packet in Wireshark and select the decode as option. Then select rtp. Now you can see RTP packets in Wireshark.


I think that you can find the solution from the following code snippet:

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();  
 }  
}
0

精彩评论

暂无评论...
验证码 换一张
取 消