简体   繁体   English

HTML5 BrightCove视频偶尔可在Android上运行

[英]HTML5 BrightCove video sporadically works on Android

I've come across the issue where the Brightcove HTML5 video that is embedded on my site shows a blank black screen after being clicked to play. 我遇到的问题是,单击播放后,嵌入在我网站上的Brightcove HTML5视频显示黑屏。 Only sporadically will the video play. 视频只会偶尔播放。 This only happens on Android Devices (I'm only QA'ing on KitKat). 这仅在Android设备上发生(我仅在KitKat上进行质量检查)。

In the non-working instances, the templateLoad and templateReady events fire but the the MediaEvents do not fire and the video does not play, just shows a black screen. 在非工作实例中,会触发templateLoad和templateReady事件,但不会触发MediaEvent,并且视频也不会播放,仅显示黑屏。

In the working instance, all the events are fired and the video and audio stream perfectly. 在工作实例中,将触发所有事件,并且视频和音频流将完美传输。

I've even come across this same issue on BrightCove's support pages for the SmartPlayer. 我什至在BrightPov的SmartPlayer支持页面上也遇到了同样的问题。 The videos function sporadically. 视频偶尔会起作用。

Wondering if others are seeing this issue in the Android WebView or if potentially this is an issue with our rendition settings. 想知道其他人是否在Android WebView中看到此问题,或者是否有可能是我们的格式设置问题。

Code is below. 代码如下。

<object id="myExperience{{ event.trailer.video_id }}" class="BrightcoveExperience">
    <param name="bgcolor" value="#FFFFFF" />
    <param name="width" value="530" />
    <param name="height" value="298" />
    <param name="playerID" value="3639386511001" />
    <param name="playerKey" value="xxx" />
    <param name="isVid" value="true" />
    <param name="wmode" value="transparent" />
    <param name="isUI" value="true" />
    <param name="dynamicStreaming" value="true" />
    <param name="includeAPI" value="true" />
    <param name="templateLoadHandler" value="onTemplateLoad" />
    <param name="templateReadyHandler" value="onTemplateReady" />
    <param name="templateErrorHandler" value="onPlayerError" />
    <param name="@videoPlayer" value="xxx" />
</object>

 (function(){
        var player,
            APIModules,
            videoPlayer,
            experienceModule;
        return {
            onTemplateLoad : function (experienceID) {
                player = brightcove.api.getExperience(experienceID);
                APIModules = brightcove.api.modules.APIModules;
                console.log('template loaded');
            },
            onTemplateReady : function (evt) {
                videoPlayer = player.getModule(APIModules.VIDEO_PLAYER);
                experienceModule = player.getModule(APIModules.EXPERIENCE);
                videoPlayer.addEventListener(brightcove.api.events.MediaEvent.BEGIN, onMediaEventFired);
                console.log('template ready');
            },
            onMediaEventFired : function (evt){
                console.log('begin event fired')
            }
        }
    }());

A default webview isn't great at playing HTML5 video. 默认的网络视图不适用于播放HTML5视频。 I've experienced "random" playback issues even with plain HTML5 video elements - it's not limited to Brightcove's player. 即使使用普通的HTML5视频元素,我也遇到过“随机”播放问题-它不仅限于Brightcove的播放器。 Essentially a standard webview isn't a capable enough browser to support video. 实质上,标准的Webview不够强大,无法支持视频。 The "HTML5 Video support" section at http://developer.android.com/reference/android/webkit/WebView.html glosses over configuration that's needed. http://developer.android.com/reference/android/webkit/WebView.html上的“ HTML5视频支持”部分掩盖了所需的配置。

In order to support inline HTML5 video in your application, you need to have hardware acceleration turned on, and set a WebChromeClient. 为了在您的应用程序中支持嵌入式HTML5视频,您需要打开硬件加速,并设置一个WebChromeClient。 For full screen support, implementations of onShowCustomView(View, WebChromeClient.CustomViewCallback) and onHideCustomView() are required, getVideoLoadingProgressView() is optional. 为了获得全屏支持,需要onShowCustomView(View,WebChromeClient.CustomViewCallback)和onHideCustomView()的实现,getVideoLoadingProgressView()是可选的。

I've had success using this custom webview with Brightcove players and other video. 我已经在Brightcove播放器和其他视频上成功使用了这种自定义Webview

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

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