android 使用嵌入代码的直播应用

android live streaming app using embed code

任何人都可以指导我如何在网络视图中调整视频大小(适合屏幕和全屏)。 我正在尝试从 android 应用中嵌入的 link 个频道进行流式传输 这是代码片段

String playVideo= "<html><body><iframe type=\"text/html\" width=\"350\" height=\"235\"src=\"http:www.skyembed.com/skysports1.php\" frameborder=\"0\"></body></html>";

webView.loadData(playVideo, "text/html", "utf-8");

提前致谢

如果你的意思是将 WebViewiframe 调整为全屏,你可以使用这个:

布局中xml

<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/webView"
></WebView>

在 java 来源:

      WebView webView=(WebView)findViewById(R.id.ww);

     // **** use width="100%" and height="100%" to fill the webview by iFrame ******
     String playVideo= "<html><body><iframe type=\"text/html\" width=\"100%\" height=\"100%\"src=\"http:www.skyembed.com/skysports1.php\" frameborder=\"0\"></body></html>";

     webView.loadData(playVideo, "text/html", "utf-8");

但是如果你的意思是调整 http:www.skyembed.com/skysports1.php 中 src 元素的大小。这不可能。这必须从服务器端完成。通过添加这样的 java 脚本:

var elem = document.getElementById("myFrame");
   if (elem.requestFullscreen) {
      elem.requestFullscreen();
       }

finallay 如果您需要播放流媒体视频,最好的方法是使用 MediaPlayerHow to play live streaming in android application?