视频播放
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
.ad-container
|
||||
{
|
||||
display:none;
|
||||
position:absolute;
|
||||
left:50%;
|
||||
top:50%;
|
||||
margin-left:-150px;
|
||||
margin-top:-100px;
|
||||
}
|
||||
|
||||
.ad-container span
|
||||
{
|
||||
width: 27px;
|
||||
height: 16px;
|
||||
border-radius: 1px;
|
||||
background-color: rgba(0,0,0,.5);
|
||||
position: absolute;
|
||||
font-size: 10px;
|
||||
color: #fff;
|
||||
line-height: 16px;
|
||||
text-align: center;
|
||||
top:0px;
|
||||
left:0px;
|
||||
}
|
||||
|
||||
.ad-container .close
|
||||
{
|
||||
position:absolute;
|
||||
top:2px;
|
||||
right:2px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.ad-container .close:hover
|
||||
{
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.ad-container .ad
|
||||
{
|
||||
width:300px;
|
||||
height:200px;
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
import $ from 'jquery'
|
||||
// const html = require('./index.html');
|
||||
// require('https://g.alicdn.com/apsara-media-box/imp-web-player/2.20.3/skins/default/aliplayer-min.css');
|
||||
|
||||
// require('../aliplayer-min.js');
|
||||
// require('../aliplayercomponents.min.js');
|
||||
// require('../aliplayer-min.css');
|
||||
require('./index.css');
|
||||
|
||||
|
||||
/**
|
||||
* 静态广告组件
|
||||
*/
|
||||
const fullScreenButtonComponent = Aliplayer.Component({
|
||||
/**
|
||||
* 初始函数,在new对象时调用
|
||||
*
|
||||
* @param {string} adAddress - 广告视频地址
|
||||
* @param {string} toAddress - 广告链接地址
|
||||
*/
|
||||
init: function (adAddress, toAddress) {
|
||||
this.adAddress = adAddress;
|
||||
this.toAddress = toAddress;
|
||||
this.$html = $('.ad-container');
|
||||
},
|
||||
|
||||
/**
|
||||
* 创建广告Dom元素
|
||||
*/
|
||||
createEl: function (el) {
|
||||
this.$html.find('.ad').attr('src', this.adAddress);
|
||||
var $adWrapper = this.$html.find('.ad-wrapper');
|
||||
$adWrapper.attr('href', this.toAddress);
|
||||
$adWrapper.click(function () {
|
||||
Aliplayer.util.stopPropagation();
|
||||
});
|
||||
this.$html.find('.close').click(function () {
|
||||
this.$html.hide();
|
||||
});
|
||||
$(el).append(this.$html);
|
||||
},
|
||||
ready: function (player, e) {
|
||||
},
|
||||
/**
|
||||
* 隐藏广告
|
||||
*/
|
||||
play: function (player, e) {
|
||||
this.$html.hide();
|
||||
},
|
||||
/**
|
||||
* 显示广告
|
||||
*/
|
||||
pause: function (player, e) {
|
||||
this.$html.show();
|
||||
},
|
||||
/**
|
||||
* 隐藏广告
|
||||
*/
|
||||
playing: function (player, e) {
|
||||
this.$html.hide();
|
||||
},
|
||||
waiting: function (player, e) {
|
||||
},
|
||||
timeupdate: function (player, e) {
|
||||
},
|
||||
error: function (player, e) {
|
||||
},
|
||||
/**
|
||||
* 显示广告
|
||||
*/
|
||||
ended: function (player, e) {
|
||||
this.$html.show();
|
||||
}
|
||||
});
|
||||
|
||||
export default fullScreenButtonComponent;
|
||||
Reference in New Issue
Block a user