使用嵌入代码的android直播流媒体应用(android live streaming app using embed code)

编程入门 行业动态 更新时间:2024-10-24 22:25:25
使用嵌入代码的android直播流媒体应用(android live streaming app using embed code)

任何人都可以指导我如何在Web视图中调整视频大小(适合屏幕和全屏)。 我试图从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");

提前

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

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

最满意答案

如果您要将WebView或iframe调整为全屏,则可以使用:

在布局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元素的大小。 这不可能。 这必须从服务器端完成。通过添加这样的javaScript:

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

如果你需要使用流媒体视频,最好的方法是使用MediaPlayer 。 如何在Android应用程序中播放实时流媒体?

If you mean resizing the WebView or iframe to full screen, you can use this :

in layout xml

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

in java source :

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 . it is not possible. this has to done from server side .by adding a javaScript like this :

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

finallay if you need to paly a streamed video , best way is using MediaPlayer. How to play live streaming in android application?

更多推荐

本文发布于:2023-07-16 12:39:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1128552.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:流媒体   代码   android   live   code

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!