小编SJS*_*oft的帖子

在Android应用程序中播放RTSP流媒体

我正在尝试开发一个基于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)

streaming android live rtsp wowza

36
推荐指数
3
解决办法
9万
查看次数

使用PHP asXML和SimpleXMLElement获取encoding ="UTF-8"standalone ="yes"

我在调用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"?>

php xml simplexml

7
推荐指数
1
解决办法
2万
查看次数

标签 统计

android ×1

live ×1

php ×1

rtsp ×1

simplexml ×1

streaming ×1

wowza ×1

xml ×1