我正在尝试开发一个基于Android的应用程序,它可以从实时流播放视频.此直播流使用Wowza Media Server生成.
URL是:
rtsp://tv.hindiworldtv.com:1935/live/getpun
Run Code Online (Sandbox Code Playgroud)
我试过在ecliplse中使用以下代码:
package com.kalloh.wpa;
import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.net.Uri;
import android.os.Bundle;
import android.view.Window;
import android.widget.MediaController;
import android.widget.VideoView;
public class a extends Activity {
VideoView videoView;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
//Create a VideoView widget in the layout file
//use setContentView method to set content of the activity to the layout file which contains videoView
this.setContentView(R.layout.videoplayer);
videoView = (VideoView)this.findViewById(R.id.videoView);
//add controls to a MediaPlayer like play, pause.
MediaController mc = new …Run Code Online (Sandbox Code Playgroud) 我在调用php页面时使用以下代码来获取XML文件:
即当你进入时http://example.com/strtoxmp.php,它将根据以下编码返回xml:
$xml = new SimpleXMLElement("<feed/>");
$feed = $xml;
$feed->addChild('resultLength', "1");
$feed->addChild('endIndex', "1");
$item = $feed->addChild('item',"");
$item->addChild('contentId', "10031");
$item->addChild('contentType', "Talk");
$item->addChild('synopsis', "$newTitle" );
$item->addChild('runtime', ' ');
}
Header('Content-type: text/xml; charset:UTF-8; ');
print($xml->asXML());
Run Code Online (Sandbox Code Playgroud)
它工作正常.它产生以下xml:
<?xml version="1.0"?>
<feed>
<resultLength>1</resultLength>
<endIndex>1</endIndex>
<contentId>10031</contentId>
<contentType>Talk</contentType>
<synopsis>Mark Harris - Find Your Wings</synopsis>
<runtime> </runtime>
</item>
</feed>
Run Code Online (Sandbox Code Playgroud)
但是我需要
<?xml version ="1.0"encoding ="UTF-8"standalone ="yes"?>
代替
<?xml version ="1.0"?>