fhefh2015
1/9/2018 - 8:28 AM

js调用腾讯视频

js调用腾讯视频

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        * {
            padding: 0;
            margin: 0;
            list-style: none;
            text-decoration: none;
        }

        body {
            font-family: "SimSun";
            font-size: 12px;
            background: #fff;
        }

        .clearfix:before, .clearfix:after {
            content: "";
            display: table;
        }

        .clearfix:after {
            clear: both;
            overflow: hidden;
        }

        .clearfix {
            zoom: 1;
        }

        img {
            border: 0;
        }

        a {
            text-decoration: none;
            position: relative;
        }

        a:hover {
            color: #6daaea !important;
        }

        a:hover:after {
            /*content: "";*/
            /*border-bottom: 1px solid #6daaea;*/
            /*position: absolute;
            left: 0;
            right: 0;
            bottom: -6px;*/
        }

        .video {
            width: 960px;
            height: 600px;
            margin: 0 auto;
        }
    </style>
    <script language="javascript" src="http://imgcache.qq.com/tencentvideo_v1/tvp/js/tvp.player_v2.js"
            charset="utf-8"></script>
</head>
<body>
<div class="video" id="video">
</div>
<script>
    var video = new tvp.VideoInfo();
    video.setVid("d0530qvziyp");
    var player = new tvp.Player();
    player.create({
        width: "960",       //播放器的宽度
        height: "600", //播放器的高度
        video: video,       //默认的视频对象
        modId: "video",       //默认的 DOM 元素 ID
        autoplay: false
    });
    player.onplaying = function (vid) {
        console.log(vid)
    }
    player.onallended = function (vid) {
        console.log(vid)
    };
</script>
</body>
</html>