JavaScript Player API

cdn

https://vm.gtimg.cn/tencentvideo/txp/js/txplayer.js

http://vm.gtimg.cn/tencentvideo/txp/js/txplayer.js

API加载完成后会触发document的TxPlayerJSBrageReady事件,然后就可以获取到播放器对象Txplayer

API Ready

$(document).on('TxPlayerJSBrageReady', function(){
  var player = new Txplayer({vid: 'kidhsk03s12x'});
});

使用JSAPI >> demo

// 创建播放器
var player = new Txplayer({
  containerId: 'container',
  vid: 'r0018hmh1pa',
  width: '100%',
  height: screen.availHeight/3
});

// 调用api
player.pause(); // 暂停播放
player.mute(); // 视频静音

// 事件监听
player.on('ready', fn); // 初始化完成
player.on('volumeChange', fn); //音量发生变化

See the Pen 使用JSAPI by zoborzhang (@zoborzhang) on CodePen.

播放器UI

PC HTML5

PC Flash

Mobile HTML5

Copyright (c) 2017 Tencent-Video Web Front End Team. all right reserved,powered by Gitbooktime: 2018-07-17 20:13:13

results matching ""

    No results matching ""

    results matching ""

      No results matching ""