简体   繁体   English

使用嵌入代码的android live stream app

[英]android live streaming app using embed code

Can anyone please guide me on how to resize video(fit to screen and full screen) in web view. 谁能指导我如何在网络视图中调整视频大小(适合全屏和全屏)。 I am trying to stream from embed link of channels in android app here is code snippet 我正在尝试从android应用程序中的频道嵌入链接中流式传输,这是代码片段

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");

thanx in advance 预先感谢

If you mean resizing the WebView or iframe to full screen, you can use this : 如果您打算将WebViewiframe调整为全屏,则可以使用以下方法:

in layout xml 在布局xml中

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

in java source : 在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");

but if you mean resizing the src elements in http:www.skyembed.com/skysports1.php . 但是如果您要调整http:www.skyembed.com/skysports1.php src元素的大小, it is not possible. 这不可能。 this has to done from server side .by adding a javaScript like this : 这必须从服务器端完成。通过添加如下所示的javaScript:

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

finallay if you need to paly a streamed video , best way is using MediaPlayer . 如果您需要播放流视频,请使用finallay,最好的方法是使用MediaPlayer How to play live streaming in android application? 如何在Android应用程序中播放实时流媒体?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM