mui 视频播放

<!DOCTYPE html>
<html>

    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
        <title></title>
        <script src="js/mui.min.js"></script>
        <link href="css/mui.min.css" rel="stylesheet" />
        <script type="text/javascript" charset="utf-8">
            mui.init();
            document.addEventListener("plusready", function() { //"plusready"事件触发时执行plus对象的方法
                judgePlatform();
            }, false);

            function judgePlatform() {
                var plat = "";
                switch(plus.os.name) {
                    case "Android":
                        // Android平台: plus.android.*
                        plat = "android";
                        var btn = document.getElementById("playBtn");
                        //监听点击事件
                        btn.addEventListener("tap", function() {
                            console.log("-------开始播放--------");
                            playVideo();
                        });
                        //触发submit按钮的点击事件
//                        mui.trigger(btn, 'tap');
                        break;
                    case "iOS":
                        // iOS平台: plus.ios.*
                        plat = "ios";
                        break;
                    default:
                        // 其它平台
                        plat = "other";
                        break;
                }
                document.getElementById("msg").innerHTML ="当前平台是:"+plat;
            }

            function playVideo() {
                var Intent = plus.android.importClass("android.content.Intent");
                var Uri = plus.android.importClass("android.net.Uri");
                var main = plus.android.runtimeMainActivity();
                var intent = new Intent(Intent.ACTION_VIEW);
                var uri = Uri.parse("http://wx.aonestep.com/video/t001.webm");
                intent.setDataAndType(uri, "video/*");
                main.startActivity(intent);
            }
        </script>
    </head>
<style type="text/css">
    div{
        text-align: center;
        margin-top: 7rem;
    }
</style>
    <body>
        <div id="msg"></div>
        <div id="">
    <button type="button" class="mui-btn mui-btn-blue" id="playBtn">播放</button>
        </div>

    </body>

</html>

 

posted @ 2017-05-03 17:17  次序  阅读(1751)  评论(0编辑  收藏  举报