在PhoneGap上将视频设置为启动画面

4

在类似phone gap/cordova的混合应用中,像当前的Ubber App一样,可以使用视频mp4或任何格式作为启动画面

4个回答

1
我知道我来晚了,但您可以使用HTML5标签在文档加载后播放视频。监听事件(视频结束)以隐藏视频并显示闪屏后的内容。
以下是示例:
<div id="splashVid" class="centerpage" style="overflow:hidden; display:block">
    <video width="100%" autoplay onended="splashEnd();">
        <source src="BT-logo-splash.mov" type="video/mp4">
        Your browser does not support the video tag.
    </video>
</div>

在函数“splashEnd()”中,您可以编写在闪屏视频结束时要执行的操作。
此外,在我的情况下,视频在应用包中本地可用。如果您使用的是URL,请确保监听其他事件以确保用户在应用程序启动时不必面对缓冲。

0

This is your splashscreen.html and splashscreen.js,include them in your app and redirect on home page after video playing is completed by setting setTimeout time

$(document).ready(function(){
         var url = $('iframe').attr('src');
         url = url+'?autoplay=1';
  $('iframe').attr('src', url);

        setTimeout(function(){
                //location.href="home.html";//redirect to home from here,you can set timeout to the video length
alert("video Completed");
            },5000);
        });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<body style="margin:0px;padding:0px;overflow:hidden">
    <iframe src="http://www.youtube.com/embed/XGSy3_Czz8k" frameborder="0" style="overflow:hidden;height:150%;width:150%" height="150%" width="150%"></iframe>
</body>


0

Cordova启动画面是一个本地对话框,它在Webview中加载混合应用程序时显示。至少这应该是正确的用法。

关于显示HTML视频/动画等的任何解决方案都是关于在Webview中显示它们。所以这完全没有用。

最好的解决方案是分叉Cordova启动画面插件并添加视频支持。


0

phonegap/Cordova 中无法将 mp4 或 gif 文件作为启动画面。您可以直接加载 index.html 页面,在那里您可以播放视频并导航到下一页。

希望这能帮到您。


嗨Naresh,谢谢您的回复。我尝试了,但视频的高度和宽度不正确。请分享任何样例。谢谢。 - user3541151

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接