【问题标题】:Show Video in WebView Issue在 WebView 问题中显示视频
【发布时间】:2016-04-15 21:57:19
【问题描述】:

我让视频以横向模式在 Web 视图中显示..

但不知何故,视频没有覆盖全屏。视频底部有一个白色的部分,有点烦人..

我尝试过使用 webview.getSettings().setUseWideViewPort(true); webview.getSettings().setLoadWithOverviewMode(true);

但他们似乎没有解决它。

如何让在 WebView 中播放的视频覆盖整个设备屏幕?

【问题讨论】:

标签: java android video webview fullscreen


【解决方案1】:

如果您的视频是直播视频,则不需要webview

我更喜欢使用 Vitamio Library 在您的应用中流式传输和显示!


如果您想在 Android 2.1 及更高版本上执行 HLT(HTTP Live Stream),您可以使用 vitamio 库。

网址:(http://www.vitamio.org/)。

这里是代码示例:主布局:

<LinearLayout android:id="@+id/LinearLayout01"
            android:layout_height="fill_parent"         xmlns:android="http://schemas.android.com/apk/res/android"
            android:paddingLeft="2px" android:paddingRight="2px"
            android:paddingTop="2px" android:paddingBottom="2px"
            android:layout_width="fill_parent" android:orientation="vertical">

            <io.vov.vitamio.widget.VideoView
                 android:layout_height="fill_parent"
                 android:layout_width="fill_parent" android:id="@+id/VideoView">               
            </io.vov.vitamio.widget.VideoView>
</LinearLayout>

类:

import io.vov.vitamio.widget.MediaController;
import io.vov.vitamio.widget.VideoView;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;



public class LiveStrimingTestActivity extends Activity{

    VideoView videoView;

    private void test_2(){
        String httpLiveUrl = "http://aj.lsops.net/live/aljazeer_en_high.sdp/playlist.m3u8";   
        videoView = (VideoView) findViewById(R.id.VideoView);
        videoView.setVideoURI(Uri.parse(httpLiveUrl));
        MediaController mediaController = new MediaController(this);
        videoView.setMediaController(mediaController);
        videoView.requestFocus();
        videoView.start();
    }


    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        test_2();             
    }     
}

【讨论】:

  • 我将如何使用它..您能提供更多详细信息吗?谢谢
  • 嗨,阿巴斯,非常感谢您的帮助。你有什么方法可以让我联系你私下询问,比如 Skype?
  • 我只有电报,你可以通过我的 id 在电报中给我发消息:telegram.me/ellip01
  • 我下载了应用,但找不到添加您的 id 的地方
猜你喜欢
  • 1970-01-01
  • 2023-03-16
  • 1970-01-01
  • 2011-11-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-01-30
  • 1970-01-01
相关资源
最近更新 更多