-
Notifications
You must be signed in to change notification settings - Fork 2
/
myplugin.html
114 lines (93 loc) · 3.47 KB
/
myplugin.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<!DOCTYPE html>
<html>
<head>
<title>Video.js | HTML5 Video Player</title>
<!-- Chang URLs to wherever Video.js files will be hosted -->
<link href="video-js.css" rel="stylesheet" type="text/css">
<!-- video.js must be in the <head> for older IEs to work. -->
<script src="video.js"></script>
<script src="api.js"></script>
<script src="vpaid.js"></script>
<!-- Unless using the CDN hosted version, update the URL to the Flash SWF -->
<script>
videojs.options.flash.swf = "video-js.swf";
log = function(obj) {
console.log(obj);
}
</script>
</head>
<body>
<div id="videoWrapper">
<video id="vid1" class="video-js vjs-default-skin" controls muted preload="none" width="640" height="264" poster="http://video-js.zencoder.com/oceans-clip.png">
<source src="282076105.mp4" type='video/mp4' />
<p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
</p>
</video>
</div>
<script type="text/javascript">
var vid1 = videojs('vid1');
environmentVars = {
slot: 'videoWrapper',
videoSlot: 'videoElement',
videoSlotCanAutoPlay: true,
LR_PUBLISHER_ID: 1331,
LR_TAGS: 'demo',
LR_MUTED: 1,
LR_LAYOUT_SKIN_MESSAGE: 'Advertisement. Video will resume in {COUNTDOWN} seconds.',
};
vid1.ads();
vid1.vpaid(environmentVars);
var LiveRailVPAID,
vpaidFrame, vpaidLoader, videoWrapper = document.getElementById('videoWrapper'),
videoElement = document.getElementById('vid1'),
initAdButton = document.getElementById('initAdButton'),
startAdButton = document.getElementById('startAdButton'),
initAdButton = document.getElementById('initAdButton');
vpaidFrame = document.createElement('iframe');
vpaidFrame.style.display = 'none';
vpaidFrame.onload = function() {
vpaidLoader = vpaidFrame.contentWindow.document.createElement('script');
vpaidLoader.src = 'LiveRail.AdManager-1.0.js';
vpaidLoader.onload = function() {
LiveRailVPAID = vpaidFrame.contentWindow.getVPAIDAd();
LiveRailVPAID.handshakeVersion('2.0');
onVPAIDLoad();
};
vpaidFrame.contentWindow.document.body.appendChild(vpaidLoader);
};
document.body.appendChild(vpaidFrame);
function playerReset() {
// videoElement.src = 'http://video-js.zencoder.com/oceans-clip.mp4';
// videoElement.load();
console.log('playerReset ');
//initAdButton.removeAttribute('disabled');
}
//DefineinitialVPAID setup
function onVPAIDLoad() {
LiveRailVPAID.subscribe(function() {
log('ad Loaded')
LiveRailVPAID.startAd();
}, 'AdLoaded');
LiveRailVPAID.subscribe(function() {
playerReset();
videojs("videoElement").play();
}, 'AdStopped');
LiveRailVPAID.subscribe(function() {
playerReset();
}, 'AdError');
LiveRailVPAID.subscribe(function(message) {
console.log(message);
}, 'AdLog');
LiveRailVPAID.subscribe(function(message) {
}, 'AdComplete');
playerReset();
}
/*
var vid = videojs("vid1", {
plugins : { vpaidPlugin : {} }
}, function() {
videoPlayer = this;
});*/
</script>
</body>
</html>