Files
medicine_app/pages/component/commonComponents/video/staticadcomponent/index.js
2024-06-19 16:12:23 +08:00

76 lines
1.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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;