【发布时间】:2017-03-19 06:37:55
【问题描述】:
我正在使用 chromecast SDK 3.0 并希望创建自定义接收器。它适用于视频和音频,但在图像投射方面存在问题。
在 html 文件中:
<body style="margin: 0">
<img id="androidImage" src="" />
...
在 js 文件中:
sampleplayer.CastPlayer.prototype.loadImage_ = function(info) {
this.log_('loadImage_');
var url = info.message.media.contentId;
document.getElementById("androidImage").src=url;
this.setState_(sampleplayer.State.PLAYING, true);
};
使用这种实现图像会在一秒钟内出现并随着替换为背景图像而消失。图像也显示不正确的尺寸。为了设置刻度类型的样式,我使用了这样的代码:
<style>
img#androidImage {
height:100%;
width:100%;
}
</style>
有人有意见吗?谢谢!
【问题讨论】:
-
它在您的浏览器中是否正常工作?如果主体不是浏览器视口的 100% 高度,则图像也无法缩放到 100% 高度。快速解决方法通常是将正文和 html 的高度设置为 100%
标签: javascript android css chromecast google-cast