Skip to content

Commit f1a2c96

Browse files
committed
add demo folder
1 parent 8cfe0a7 commit f1a2c96

File tree

6 files changed

+87
-2
lines changed

6 files changed

+87
-2
lines changed

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
test/
2+
demo/
23
.yarn
34
.DS_Store
45
node_modules/

demo/index.html

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<!doctype html><html lang="en"><head><meta charset="UTF-8"><title>Wistia player alternative</title><meta name="keywords" content=""><meta name="description" content=""><meta content="always" name="referrer"><meta name="theme-color" content="#3B9FDD"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="mobile-web-app-capable" content="yes"><style>body {
2+
margin: 0;
3+
padding: 0;
4+
display: flex;
5+
flex-direction: column;
6+
justify-content: center;
7+
align-items: center;
8+
align-content: center;
9+
min-height: 100vh;
10+
}
11+
.demo-title {
12+
padding: 1em;
13+
font-size: 1.5em;
14+
text-align: center;
15+
}
16+
.demo-wrap {
17+
width: 80%;
18+
max-width: 1440px;
19+
height: auto;
20+
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
21+
}
22+
.demo-wrap::before {
23+
content: "";
24+
padding-top: 56%;
25+
display: block;
26+
float: left;
27+
}
28+
.demo-wrap::after {
29+
content: "";
30+
display: table;
31+
clear: both;
32+
} .console {
33+
background-color: black;
34+
padding: 1em;
35+
}
36+
.console pre {
37+
width: 100%;
38+
color: white;
39+
line-height: 1.5;
40+
margin: 0;
41+
}
42+
@media (max-width: 768px) {
43+
.demo-wrap {
44+
width: 100%;
45+
}
46+
}</style><script>var MEDIA_ENDPOINT = "https://demo.static.mixmedia.com/wistia-backup/cloudfront/media";</script><script defer="defer" src="js/wistia-s3-player.min.js?dccb305db13216a1a354"></script></head><body><h3 class="demo-title">WISTIA PLAYER ALTERNATIVE DEMO</h3><div class="demo-wrap"><div class="wistia_responsive_padding"><div class="wistia_responsive_wrapper"><div class="wistia_embed wistia_async_u7k1cgyjy0 videoFoam=true playsinline=true" style="height:100%;width:100%">&nbsp;</div></div></div><div class="console"><pre></pre></div></div><script>(function (){
47+
var queue = [];
48+
function writeLog(msg) {
49+
queue.push(msg);
50+
var buffer = [];
51+
for(var i = 0; i <= queue.length && i < 4 ; i++) {
52+
buffer.unshift(queue[queue.length - i]);
53+
}
54+
55+
var pre = document.querySelector(".console pre");
56+
pre.innerHTML = buffer.join("\n");
57+
}
58+
59+
window.dataLayer = window.dataLayer || {
60+
push: function () {
61+
writeLog(JSON.stringify(arguments));
62+
},
63+
};
64+
65+
window.addEventListener("video-player-ready", function (e) {
66+
var player = e.detail;
67+
player.bind("play", function () {
68+
writeLog("video play");
69+
});
70+
player.bind("end", function () {
71+
writeLog("video end");
72+
});
73+
player.bind("percentwatchedchanged", function (percent, lastPercent) {
74+
if (percent % 10 == 0) {
75+
writeLog("video percent watched: " + percent + "%");
76+
}
77+
});
78+
});
79+
})()</script></body></html>

demo/js/wistia-s3-player.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/js/wistia-s3-player.min.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"scripts": {
1313
"build": "cross-env NODE_ENV=production webpack --mode=production --progress",
1414
"serve": "cross-env NODE_ENV=development FRP_ENDPOINT=192.168.33.6 FRP_PUBLIC_DOMAIN=dev.mixmedia.com webpack-dev-server",
15+
"demo": "cross-env NODE_ENV=production EXPORT_DEMO=true webpack --mode=production --progress",
1516
"test": "mocha"
1617
},
1718
"author": "Mixmedia",

webpack.config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const FRP_API_USER = process.env.FRP_API_USER || 'admin';
1616
const FRP_API_PWD = process.env.FRP_API_PWD || 'admin';
1717
const FRP_PUBLIC_DOMAIN = process.env.FRP_PUBLIC_DOMAIN || 'localhost';
1818
const IN_DEVSERVER = process.env.WEBPACK_DEV_SERVER || process.env.WEBPACK_SERVE;
19+
const EXPORT_DEMO = process.env.EXPORT_DEMO;
1920

2021
const checkSubDomainExist = (domain) => {
2122
const auth = `${FRP_API_USER}:${FRP_API_PWD}`;
@@ -121,7 +122,7 @@ const config = {
121122
},
122123

123124
output: {
124-
path: path.resolve(__dirname, 'dist'),
125+
path: path.resolve(__dirname, (EXPORT_DEMO ? 'demo' : 'dist')),
125126
filename: IN_DEVSERVER ? 'js/[name].js' : 'js/[name].min.js',
126127
assetModuleFilename: 'assets/[hash][ext][query]',
127128
publicPath: "auto",
@@ -153,7 +154,7 @@ const config = {
153154

154155
new webpack.DefinePlugin({
155156
__VUE_OPTIONS_API__: 'true',
156-
__VUE_PROD_DEVTOOLS__: IN_DEVSERVER ? 'true' : 'false',
157+
__VUE_PROD_DEVTOOLS__: (IN_DEVSERVER || EXPORT_DEMO) ? 'true' : 'false',
157158
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: IN_DEVSERVER ? 'true' : 'false'
158159
}),
159160

0 commit comments

Comments
 (0)