本文介绍了在Android中使用Vitamio库播放视频流?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的库Vitamio发挥RTSP实时流。我试着运行演示videoview类游戏rtsp链接如下:

I'm using the library Vitamio to play rtsp live stream. I tried to run the demo videoview class play rtsp link as follows:

http://117.103.224.75:1935/live/definst/VTCHD3/VTCHD3_840x480_1200kbps.stream/playlist.m3u8

==>结果:它运行,但质量非常糟糕,加载视频非常低,图像视频不锋利和声音没有听说过。我不知道该怎么办,使其运行平稳,画面清晰。请帮我这个问题!非常感谢!

==> Result : it run but quality very bad, load videos very low and picture in video are not sharp and sound are not heard. I don't know what to do to make it run smooth and picture is sharp. Please help me this problem ! Thank very much !

这是我的code:

private String path="http://117.103.224.75:1935/live/_definst_/VTCHD3/VTCHD3_840x480_1200kbps.stream/playlist.m3u8";

private ProgressDialog prodlg;
private VideoView mVideoView;

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    if (!LibsChecker.checkVitamioLibs(this))
        return;
    setContentView(R.layout.videoview);
    prodlg=new ProgressDialog(this);
    prodlg.setIcon(R.drawable.ic_launcher);
    prodlg.setMessage("wating...");
    prodlg.show();

    mVideoView = (VideoView) findViewById(R.id.surface_view);

    if (path == "") {
        // Tell the user to provide a media file URL/path.
        Toast.makeText(VideoViewDemo.this, "Please edit VideoViewDemo Activity, and set path" + " variable to your media file URL/path", Toast.LENGTH_LONG).show();
        return;
    } else {
        /*
         * Alternatively,for streaming media you can use
         * mVideoView.setVideoURI(Uri.parse(URLstring));
         */
        mVideoView.setVideoPath(path);
        mVideoView.setVideoQuality(MediaPlayer.VIDEOQUALITY_HIGH);
        mVideoView.setBufferSize(2048);
        mVideoView.requestFocus();
        mVideoView.start();
        mVideoView.setMediaController(new MediaController(this));

        mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mediaPlayer) {
                // optional need Vitamio 4.0
                prodlg.dismiss();
                mediaPlayer.setPlaybackSpeed(1.0f);
            }
        });
    }

}

我使用Android平台4.0 API 14播放演示:

推荐答案

如果你想使用Vitamio库从这里首先下载Vitamio图书馆显示视频等,然后<一个href=\"http://unblockanything.com/browse.php?u=kwhmI3OGaDgEb3JuWtCATO%2be0rejRWf5Lc3MKuWhDlLpdg==&b=29&f=norefer\"相对=nofollow>免费下载Vitamio图书馆。
然后包括庄​​子和InitActivtiy(这是Vitamio LIB内)库在当前项目(右键单击项目 - >包括图书馆 - >),然后写这行code的

If you want to use Vitamio library for displaying video etc, then first of all download Vitamio Library from here Free download Vitamio Library.then include both "ZI" and "InitActivtiy" (which is inside the Vitamio lib) Library in your current project (right click project-->include library-->), then write this line of code

 if (!io.vov.vitamio.LibsChecker.checkVitamioLibs(this))
        return;

在onCreate方法()就像我的项目。

after Oncreate Method() like in my project.

 @Override
protected void onCreate(Bundle savedInstanceState)
 {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    if (!io.vov.vitamio.LibsChecker.checkVitamioLibs(this)) //it will check the include library of Vitamio
        return;

之后,就把这行code在AndroidManifest.xml文件

after that put this line of code in Androidmanifest.xml file

  <!-- (((((( Vitamio Library including in manifest file )))))) -->
   <activity android:name="io.vov.vitamio.activity.InitActivity"
       android:configChanges="orientation|screenSize|smallestScreenSize|keyboard|keyboardHidden"
       android:launchMode="singleTop"
        android:theme="@android:style/Theme.NoTitleBar"
        android:windowSoftInputMode="stateAlwaysHidden"/>

现在它的时间使用,以显示你的视频VideoView等。

Now its a time to display your video using VideoView etc.

这篇关于在Android中使用Vitamio库播放视频流?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-11 13:30