我想开发android应用程序,它将从本地服务器上播放rtsp链接,但是平板电脑屏幕变成了空白.没有显示我曾经尝试过VideoView和MediaPlayer类。在youtube rtsp链接上使用.3gp扩展很好,但不使用下面的URL是我的代码
public class WifiManagerActivity extends Activity {
private WifiManager customWifiManager;
private VideoView mu;
private String path;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
wifiSettings();
}
private void wifiSettings() {
mu = (VideoView) findViewById(R.id.ttl);
TextView notify = (TextView) findViewById(R.id.wifi_state);
customWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
if(customWifiManager.isWifiEnabled()){
Toast.makeText(this, "Your wifi is On now enjoy " +
"live streaming", Toast.LENGTH_SHORT).show();
notify.setTextColor(Color.GREEN);
showVideo();
}else{
Toast.makeText(this, "Turn your Wifi On", Toast.LENGTH_SHORT).show();
customWifiManager.setWifiEnabled(true);
//two second wait here
showVideo();
}
}
private void showVideo() {
Authenticator.setDefault(new MyAuthenticater());
String path = "rtsp://192.168.1.155:554/3g";
mu.setVideoURI(Uri.parse(path));
mu.setMediaController(new MediaController(this));
mu.requestFocus();
mu.start();
}
}发布于 2012-07-06 10:29:51
有多个因素可以影响您的流是否正确播放:
这应该能让你开始。
https://stackoverflow.com/questions/9696603
复制相似问题