Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c96a0fe43f | |||
|
|
95123ef6a3 | ||
|
|
2425e58db0 | ||
| a3b2b36c78 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,5 +1,5 @@
|
||||
# Custom files
|
||||
bundle.php
|
||||
bundle/
|
||||
|
||||
# Logs
|
||||
logs
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
|
||||
|
||||
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# videojs-player
|
||||
|
||||
The main core of most vjs players i use in sites such as: hoover highschool, rogers highschool.
|
||||
@@ -1,7 +0,0 @@
|
||||
// requirecss ../css/videojs-errors.css
|
||||
// requirecss ../css/videojs-ads.css
|
||||
// requirecss ../css/videojs-overlay.css
|
||||
// requirecss ../css/videojs-replay.css
|
||||
// requirecss ../css/videojs-share.css
|
||||
// requirecss ../css/videojs-vr.min.css
|
||||
// requirecss ../css/videojs-watermark.css
|
||||
@@ -1,8 +0,0 @@
|
||||
// requirecss ../css/bundle-header.info
|
||||
// requirecss ../css/videojs-errors.css
|
||||
// requirecss ../css/videojs-ads.css
|
||||
// requirecss ../css/videojs-overlay.css
|
||||
// requirecss ../css/videojs-replay.css
|
||||
// requirecss ../css/videojs-share.css
|
||||
// requirecss ../css/videojs-vr.min.css
|
||||
// requirecss ../css/videojs-watermark.css
|
||||
@@ -1,8 +0,0 @@
|
||||
// requirejs ../js/videojs-errors.min.js
|
||||
// requirejs ../js/videojs-hotkeys.min.js
|
||||
// requirejs ../js/videojs-contrib-ads.min.js
|
||||
// requirejs ../js/videojs-overlay.min.js
|
||||
// requirejs ../js/videojs-share.min.js
|
||||
// requirejs ../js/videojs-watermark.min.js
|
||||
// requirejs ../js/videojs-vr.min.js
|
||||
// requirejs ../js/videojs-youtube.min.js
|
||||
@@ -1,9 +0,0 @@
|
||||
// requirejs ../js/header.info
|
||||
// requirejs ../js/videojs-errors.min.js
|
||||
// requirejs ../js/videojs-hotkeys.min.js
|
||||
// requirejs ../js/videojs-contrib-ads.min.js
|
||||
// requirejs ../js/videojs-overlay.min.js
|
||||
// requirejs ../js/videojs-share.min.js
|
||||
// requirejs ../js/videojs-watermark.min.js
|
||||
// requirejs ../js/videojs-vr.min.js
|
||||
// requirejs ../js/videojs-youtube.min.js
|
||||
@@ -1,2 +0,0 @@
|
||||
// requirejs ../js/videojs-bundle.min.js
|
||||
// requirejs ../player-init-plugin-v2.js
|
||||
@@ -1,2 +0,0 @@
|
||||
// requirejs ../js/videojs-bundle.min.js
|
||||
// requirejs ../player-init-plugin-v2.js
|
||||
@@ -1,25 +0,0 @@
|
||||
const bundle = require('bundle-js-css');
|
||||
|
||||
//Bundle CSS:
|
||||
bundle.css({
|
||||
entry : './bundle-config/css-dev.info',
|
||||
dest : './css/videojs-bundle-dev.min.css',
|
||||
print : false,
|
||||
disablebeautify : false
|
||||
});
|
||||
|
||||
//Bundle all viedo-js plugins:
|
||||
bundle.js({
|
||||
entry : './bundle-config/js-dev.info',
|
||||
dest : './js/videojs-bundle-dev.min.js',
|
||||
print : false,
|
||||
disablebeautify : false
|
||||
});
|
||||
|
||||
//Bundle videojs and player-init into 1 script:
|
||||
bundle.js({
|
||||
entry : './bundle-config/videojs-dev.info',
|
||||
dest : './hooverhigh-videojs-player-dev.min.js',
|
||||
print : false,
|
||||
disablebeautify : false
|
||||
});
|
||||
@@ -1,25 +0,0 @@
|
||||
const bundle = require('bundle-js-css');
|
||||
|
||||
//Bundle CSS:
|
||||
bundle.css({
|
||||
entry : './bundle-config/css-prod.info',
|
||||
dest : './css/videojs-bundle.min.css',
|
||||
print : false,
|
||||
disablebeautify : false
|
||||
});
|
||||
|
||||
//Bundle all viedo-js plugins:
|
||||
bundle.js({
|
||||
entry : './bundle-config/js-prod.info',
|
||||
dest : './js/videojs-bundle.min.js',
|
||||
print : false,
|
||||
disablebeautify : true
|
||||
});
|
||||
|
||||
//Bundle videojs and player-init into 1 script:
|
||||
bundle.js({
|
||||
entry : './bundle-config/videojs-prod.info',
|
||||
dest : './hooverhigh-videojs-player.min.js',
|
||||
print : false,
|
||||
disablebeautify : true
|
||||
});
|
||||
78
bundle.js
Normal file
78
bundle.js
Normal file
@@ -0,0 +1,78 @@
|
||||
const minify = require('@node-minify/core');
|
||||
const csso = require('@node-minify/csso');
|
||||
const terser = require('@node-minify/terser');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
// Specify the order JS and CSS files in arrays
|
||||
const jsFiles = [
|
||||
'node_modules/video.js/dist/video.min.js',
|
||||
'node_modules/videojs-errors/dist/videojs-errors.min.js',
|
||||
'node_modules/videojs-hotkeys/videojs.hotkeys.min.js',
|
||||
'node_modules/videojs-contrib-ads/dist/videojs-contrib-ads.min.js',
|
||||
'node_modules/@viostream/videojs-overlay/dist/videojs-overlay.min.js',
|
||||
'src/module/share/share.js',
|
||||
'src/module/watermark/watermark.js',
|
||||
'node_modules/videojs-vr/dist/videojs-vr.min.js',
|
||||
'node_modules/videojs-youtube/dist/Youtube.min.js',
|
||||
'src/module/ads/ad.js',
|
||||
'src/player.js'
|
||||
];
|
||||
|
||||
const cssFiles = [
|
||||
'node_modules/video.js/dist/video-js.min.css',
|
||||
'node_modules/videojs-errors/dist/videojs-errors.css',
|
||||
'node_modules/videojs-contrib-ads/dist/videojs-contrib-ads.css',
|
||||
'node_modules/@viostream/videojs-overlay/dist/videojs-overlay.css',
|
||||
'src/module/share/share.css',
|
||||
'src/module/watermark/watermark.css',
|
||||
'node_modules/videojs-vr/dist/videojs-vr.css'
|
||||
];
|
||||
|
||||
// Function to concatenate files and minify the combined file
|
||||
const concatenateAndMinify = (files, minifier, outputFile) => {
|
||||
const fileType = path.extname(files[0]).slice(1); // Get the file type dynamically (js or css)
|
||||
const combinedFilePath = path.join(__dirname, 'bundle', `combined.${fileType}`);
|
||||
|
||||
// Concatenate content of each file and write to combined file
|
||||
let combinedContent = '';
|
||||
files.forEach(file => {
|
||||
const content = fs.readFileSync(path.join(__dirname, file), 'utf-8');
|
||||
combinedContent += content + '\n'; // Add file content with newline
|
||||
});
|
||||
|
||||
// Write the concatenated content to the combined file
|
||||
fs.writeFileSync(combinedFilePath, combinedContent, 'utf-8');
|
||||
console.log(`Combined ${fileType} file created: ${combinedFilePath}`);
|
||||
|
||||
// Now minify the combined file
|
||||
minify({
|
||||
compressor: minifier,
|
||||
input: combinedFilePath,
|
||||
output: path.join(__dirname, 'bundle', outputFile),
|
||||
callback: (err, min) => {
|
||||
if (err) {
|
||||
console.error(`Error minifying ${outputFile}:`, err);
|
||||
} else {
|
||||
console.log(`${outputFile} minified successfully!`);
|
||||
// Optionally delete the combined file after minification
|
||||
fs.unlinkSync(combinedFilePath);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Ensure the bundle directory exists
|
||||
const bundleDir = path.join(__dirname, 'bundle');
|
||||
if (!fs.existsSync(bundleDir)) {
|
||||
fs.mkdirSync(bundleDir);
|
||||
}
|
||||
|
||||
// Bundle file anme base
|
||||
var bundleFileName = 'vjs-player-bundle';
|
||||
|
||||
// Concatenate and minify JS files into one file
|
||||
concatenateAndMinify(jsFiles, terser, `${bundleFileName}.min.js`);
|
||||
|
||||
// Concatenate and minify CSS files into one file
|
||||
concatenateAndMinify(cssFiles, csso, `${bundleFileName}.min.css`);
|
||||
10
bundle.sh
10
bundle.sh
@@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Loading nodejs"
|
||||
#Enable NVM/NODEJS/NPM
|
||||
export NVM_DIR=/usr/local/nvm
|
||||
source /opt/nvm/nvm.sh
|
||||
cd /hosting/sites/hooverhigh/videojs-plugins
|
||||
echo "In directory: $(pwd)"
|
||||
#Start server
|
||||
node bundle-$1.js
|
||||
@@ -1,5 +0,0 @@
|
||||
/**
|
||||
* This css file includes a bundled version of videojs css and videojs plugins css designed for hooverhigh
|
||||
* HooverHighVideoPlayer 2 <https://hooverhigh.ml/>
|
||||
* Copyright oxmc. <https://oxmc.xyz/>
|
||||
*/
|
||||
@@ -1 +0,0 @@
|
||||
.vjs-ad-playing.vjs-ad-playing .vjs-progress-control{pointer-events:none}.vjs-ad-playing.vjs-ad-playing .vjs-play-progress{background-color:#ffe400}.vjs-ad-loading .vjs-loading-spinner{display:block;visibility:visible}.vjs-ad-playing .vjs-captions-button{display:none}.vjs-ad-playing .vjs-audio-button{display:none}.vjs-ad-loading .vjs-loading-spinner:before,.vjs-ad-loading .vjs-loading-spinner:after{-webkit-animation:vjs-spinner-spin 1.1s cubic-bezier(0.6, 0.2, 0, 0.8) infinite,vjs-spinner-fade 1.1s linear infinite;animation:vjs-spinner-spin 1.1s cubic-bezier(0.6, 0.2, 0, 0.8) infinite,vjs-spinner-fade 1.1s linear infinite}.vjs-ad-loading .vjs-loading-spinner:before{border-top-color:#fff}.vjs-ad-loading .vjs-loading-spinner:after{border-top-color:#fff;-webkit-animation-delay:0.44s;animation-delay:0.44s}.vjs-ad-loading .vjs-big-play-button,.vjs-ad-loading .vjs-poster,.vjs-ad-content-resuming .vjs-big-play-button,.vjs-ad-content-resuming .vjs-poster{display:none}
|
||||
2
css/videojs-bundle-dev.min.css
vendored
2
css/videojs-bundle-dev.min.css
vendored
File diff suppressed because one or more lines are too long
2
css/videojs-bundle.min.css
vendored
2
css/videojs-bundle.min.css
vendored
File diff suppressed because one or more lines are too long
@@ -1,2 +0,0 @@
|
||||
/*! @name videojs-errors @version 6.0.0 @license Apache-2.0 */
|
||||
.vjs-error-display{color:#fff;display:none;font-family:Helvetica,Arial,sans serif;font-size:16px;line-height:1.428}.vjs-error .vjs-error-display{display:block;position:absolute;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.5)}.vjs-error .vjs-error-display .vjs-modal-dialog-content{font-size:14px}.vjs-errors-dialog{text-align:left;border:1px #999 solid;overflow:hidden;position:absolute;top:2%;bottom:2%;left:5%;right:5%;padding-left:1%;padding-right:1%;background:rgba(24,24,24,.8)}.vjs-errors-details{margin-top:15px}.vjs-errors-message{border:1px #999 solid;background-color:#2c2c2c;overflow:auto;margin-top:15px;padding:15px}.vjs-errors-ok-button-container{display:block;position:absolute;bottom:15px;left:15px;right:15px;text-align:center}.vjs-errors-ok-button,.vjs-errors-timeout-button-container button{display:block;height:36px;background-color:#000;border:1px #999 solid;border-radius:5px;color:#999;font-size:14px;cursor:pointer}.vjs-errors-ok-button{margin:0 auto;width:80px}.vjs-errors-ok-button:hover,.vjs-errors-timeout-button-container button:hover{border:1px #fff solid;color:#ccc}.vjs-errors-timeout-button-container{display:flex;flex-direction:row;justify-content:center;gap:10px;position:absolute;bottom:15px;left:15px;right:15px;text-align:center}.vjs-errors-timeout-button-container button{width:120px}.vjs-errors-content-container{overflow:auto;position:absolute;padding-bottom:15px;top:0;left:15px;right:15px;bottom:61px}.vjs-errors-headline{font-size:14px;font-weight:700;padding-right:3em}.vjs-errors-dialog .vjs-control.vjs-close-button{width:3em;height:3em;top:0}.vjs-errors-flashmessage{float:right;font-size:9px;font-style:italic}.vjs-xs.vjs-error-display{font-size:14px;background-color:#000}.vjs-xs.vjs-error-display .vjs-errors-details,.vjs-xs.vjs-error-display .vjs-errors-message{display:none}.vjs-xs .vjs-errors-content-container{top:0}.vjs-xs .vjs-errors-headline{font-size:16px;font-weight:700}.vjs-xs .vjs-errors-dialog{border:0;top:0;bottom:0;left:0;right:0}.vjs-xs.vjs-errors-flashmessage{display:none}@media (max-width:600px),(max-height:250px){.vjs-error-display{font-size:14px;background-color:#000}.vjs-error-display .vjs-errors-details,.vjs-error-display .vjs-errors-message,.vjs-errors-flashmessage{display:none}.vjs-error-display .vjs-errors-content-container{top:15px}.vjs-error-display .vjs-errors-headline{font-size:16px;font-weight:700}.vjs-error-display .vjs-errors-dialog{border:0;top:0;bottom:0;left:0;right:0}}
|
||||
@@ -1,62 +0,0 @@
|
||||
.video-js .vjs-overlay {
|
||||
color: #fff;
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
}
|
||||
.video-js .vjs-overlay-no-background {
|
||||
max-width: 33%;
|
||||
}
|
||||
.video-js .vjs-overlay-background {
|
||||
background-color: #646464;
|
||||
background-color: rgba(255, 255, 255, 0.4);
|
||||
border-radius: 3px;
|
||||
padding: 10px;
|
||||
width: 33%;
|
||||
}
|
||||
.video-js .vjs-overlay-top-left {
|
||||
top: 5px;
|
||||
left: 5px;
|
||||
}
|
||||
.video-js .vjs-overlay-top {
|
||||
left: 50%;
|
||||
margin-left: -16.5%;
|
||||
top: 5px;
|
||||
}
|
||||
.video-js .vjs-overlay-top-right {
|
||||
right: 5px;
|
||||
top: 5px;
|
||||
}
|
||||
.video-js .vjs-overlay-right {
|
||||
right: 5px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
.video-js .vjs-overlay-bottom-right {
|
||||
bottom: 3.5em;
|
||||
right: 5px;
|
||||
}
|
||||
.video-js .vjs-overlay-bottom {
|
||||
bottom: 3.5em;
|
||||
left: 50%;
|
||||
margin-left: -16.5%;
|
||||
}
|
||||
.video-js .vjs-overlay-bottom-left {
|
||||
bottom: 3.5em;
|
||||
left: 5px;
|
||||
}
|
||||
.video-js .vjs-overlay-left {
|
||||
left: 5px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
.video-js .vjs-overlay-center {
|
||||
left: 50%;
|
||||
margin-left: -16.5%;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
.video-js .vjs-no-flex .vjs-overlay-left,
|
||||
.video-js .vjs-no-flex .vjs-overlay-center,
|
||||
.video-js .vjs-no-flex .vjs-overlay-right {
|
||||
margin-top: -15px;
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
.video-js.vjs-replay .vjs-play-control:before{content:""}
|
||||
@@ -1,7 +0,0 @@
|
||||
/**
|
||||
* videojs-share
|
||||
* @version 3.2.1
|
||||
* @copyright 2019 Mikhail Khazov <mkhazov.work@gmail.com>
|
||||
* @license MIT
|
||||
*/
|
||||
.video-js.vjs-videojs-share_open .vjs-modal-dialog .vjs-modal-dialog-content{display:flex;align-items:center;padding:0;background-image:linear-gradient(to bottom, rgba(0,0,0,0.77), rgba(0,0,0,0.75))}.video-js.vjs-videojs-share_open .vjs-modal-dialog .vjs-close-button{position:absolute;right:0;top:5px;width:30px;height:30px;color:#fff;cursor:pointer;opacity:0.9;transition:opacity 0.25s ease-out}.video-js.vjs-videojs-share_open .vjs-modal-dialog .vjs-close-button:before{content:'×';font-size:20px;line-height:15px}.video-js.vjs-videojs-share_open .vjs-modal-dialog .vjs-close-button:hover{opacity:1}.video-js .vjs-share{display:flex;flex-direction:column;justify-content:space-around;align-items:center;width:100%;height:100%;max-height:400px}.video-js .vjs-share__top,.video-js .vjs-share__middle,.video-js .vjs-share__bottom{display:flex}.video-js .vjs-share__top,.video-js .vjs-share__middle{flex-direction:column;justify-content:space-between}.video-js .vjs-share__middle{padding:0 25px}.video-js .vjs-share__title{align-self:center;font-size:22px;color:#fff}.video-js .vjs-share__subtitle{width:100%;margin:0 auto 12px;font-size:16px;color:#fff;opacity:0.7}.video-js .vjs-share__short-link-wrapper{position:relative;display:block;width:100%;height:40px;margin:0 auto;margin-bottom:15px;border:0;color:rgba(255,255,255,0.65);background-color:#363636;outline:none;overflow:hidden;flex-shrink:0}.video-js .vjs-share__short-link{display:block;width:100%;height:100%;padding:0 40px 0 15px;border:0;color:rgba(255,255,255,0.65);background-color:#363636;outline:none}.video-js .vjs-share__btn{position:absolute;right:0;bottom:0;height:40px;width:40px;display:flex;align-items:center;padding:0 11px;border:0;color:#fff;background-color:#2e2e2e;background-size:18px 19px;background-position:center;background-repeat:no-repeat;cursor:pointer;outline:none;transition:width 0.3s ease-out, padding 0.3s ease-out}.video-js .vjs-share__btn svg{flex-shrink:0}.video-js .vjs-share__btn span{position:relative;padding-left:10px;opacity:0;transition:opacity 0.3s ease-out}.video-js .vjs-share__btn:hover{justify-content:center;width:100%;padding:0 40px;background-image:none}.video-js .vjs-share__btn:hover span{opacity:1}.video-js .vjs-share__socials{display:flex;flex-wrap:wrap;justify-content:center;align-content:flex-start;transition:width 0.3s ease-out, height 0.3s ease-out}.video-js .vjs-share__social{display:flex;justify-content:center;align-items:center;flex-shrink:0;width:32px;height:32px;margin-right:6px;margin-bottom:6px;cursor:pointer;font-size:8px;transition:transform 0.3s ease-out, filter 0.2s ease-out;border:none;outline:none}.video-js .vjs-share__social:hover{filter:brightness(115%)}.video-js .vjs-share__social svg{overflow:visible;max-height:24px}.video-js .vjs-share__social_vk{background-color:#5d7294}.video-js .vjs-share__social_ok{background-color:#ed7c20}.video-js .vjs-share__social_mail,.video-js .vjs-share__social_email{background-color:#134785}.video-js .vjs-share__social_tw{background-color:#76aaeb}.video-js .vjs-share__social_reddit{background-color:#ff4500}.video-js .vjs-share__social_fbFeed{background-color:#475995}.video-js .vjs-share__social_messenger{background-color:#0084ff}.video-js .vjs-share__social_gp{background-color:#d53f35}.video-js .vjs-share__social_linkedin{background-color:#0077b5}.video-js .vjs-share__social_viber{background-color:#766db5}.video-js .vjs-share__social_telegram{background-color:#4bb0e2}.video-js .vjs-share__social_whatsapp{background-color:#78c870}.video-js .vjs-share__bottom{justify-content:center}@media (max-height: 220px){.video-js .vjs-share .hidden-xs{display:none}}@media (max-height: 350px){.video-js .vjs-share .hidden-sm{display:none}}@media (min-height: 400px){.video-js .vjs-share__title{margin-bottom:15px}.video-js .vjs-share__short-link-wrapper{margin-bottom:30px}}@media (min-width: 320px){.video-js.vjs-videojs-share_open .vjs-modal-dialog .vjs-close-button{right:5px;top:10px}}@media (min-width: 660px){.video-js.vjs-videojs-share_open .vjs-modal-dialog .vjs-close-button{right:20px;top:20px}.video-js .vjs-share__social{width:40px;height:40px}}
|
||||
1
css/videojs-vr.min.css
vendored
1
css/videojs-vr.min.css
vendored
@@ -1 +0,0 @@
|
||||
.video-js .vjs-big-vr-play-button{width:100px;height:100px;background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='360' viewBox='0 0 360 360'%3E%3Cpath fill='%23FFF' d='M334.883 275.78l-6.374-36.198-6.375-36.2-28.16 23.62-28.164 23.62 25.837 9.41C266.247 296.544 224 320.5 176.25 320.5c-77.47 0-140.5-63.03-140.5-140.5 0-77.472 63.03-140.5 140.5-140.5 53.428 0 99.98 29.978 123.733 73.993l13.304-6.923C287.025 57.76 235.45 24.5 176.25 24.5c-85.743 0-155.5 69.757-155.5 155.5 0 85.742 69.757 155.5 155.5 155.5 54.253 0 102.09-27.94 129.922-70.177l28.71 10.457z'/%3E%3Cpath fill='%23FFF' d='M314.492 175.167c-12.98 0-23.54-10.56-23.54-23.54s10.56-23.54 23.54-23.54c12.98 0 23.54 10.56 23.54 23.54s-10.56 23.54-23.54 23.54zm0-38.08c-8.018 0-14.54 6.522-14.54 14.54s6.522 14.54 14.54 14.54c8.017 0 14.54-6.522 14.54-14.54s-6.523-14.54-14.54-14.54z'/%3E%3Cg fill='%23FFF'%3E%3Cpath d='M88.76 173.102h9.395c4.74-.042 8.495-1.27 11.268-3.682 2.77-2.412 4.157-5.903 4.157-10.474 0-4.4-1.153-7.817-3.46-10.25-2.307-2.434-5.83-3.65-10.568-3.65-4.147 0-7.554 1.195-10.22 3.585-2.666 2.392-4 5.514-4 9.364H69.908c0-4.74 1.26-9.055 3.776-12.95 2.518-3.892 6.03-6.928 10.537-9.108 4.508-2.18 9.554-3.27 15.14-3.27 9.225 0 16.472 2.318 21.74 6.952 5.27 4.634 7.903 11.077 7.903 19.33 0 4.147-1.323 8.05-3.967 11.71-2.646 3.66-6.062 6.422-10.252 8.284 5.078 1.736 8.94 4.465 11.584 8.19s3.968 8.166 3.968 13.33c0 8.294-2.847 14.895-8.538 19.804s-13.17 7.363-22.438 7.363c-8.887 0-16.166-2.37-21.836-7.11-5.67-4.74-8.506-11.045-8.506-18.916h15.425c0 4.062 1.365 7.363 4.094 9.902 2.73 2.54 6.4 3.81 11.014 3.81 4.782 0 8.55-1.27 11.3-3.81s4.126-6.22 4.126-11.045c0-4.865-1.44-8.61-4.316-11.235-2.878-2.623-7.152-3.936-12.822-3.936H88.76V173.1zM187.598 133.493v12.76h-1.904c-8.633.126-15.53 2.497-20.693 7.108-5.162 4.614-8.23 11.152-9.203 19.615 4.95-5.205 11.277-7.808 18.98-7.808 8.166 0 14.608 2.878 19.328 8.633 4.718 5.755 7.077 13.182 7.077 22.28 0 9.395-2.76 17.002-8.284 22.82-5.52 5.818-12.77 8.73-21.74 8.73-9.226 0-16.705-3.407-22.44-10.222-5.733-6.812-8.6-15.742-8.6-26.787v-5.267c0-16.208 3.945-28.903 11.84-38.086 7.89-9.182 19.242-13.774 34.054-13.774h1.586zM171.03 177.61c-3.386 0-6.485.95-9.3 2.855-2.814 1.904-4.877 4.443-6.188 7.617v4.697c0 6.854 1.438 12.304 4.316 16.345 2.877 4.04 6.602 6.062 11.172 6.062s8.188-1.715 10.854-5.143 4-7.934 4-13.52-1.355-10.135-4.063-13.648c-2.708-3.51-6.304-5.267-10.79-5.267zM271.136 187.447c0 13.29-2.486 23.307-7.46 30.057s-12.535 10.125-22.69 10.125c-9.988 0-17.51-3.292-22.566-9.872-5.058-6.58-7.65-16.323-7.776-29.23V172.53c0-13.287 2.485-23.252 7.458-29.896 4.973-6.643 12.558-9.966 22.757-9.966 10.112 0 17.655 3.237 22.63 9.712 4.97 6.475 7.52 16.166 7.647 29.072v15.995zm-15.425-17.265c0-8.674-1.185-15.033-3.554-19.075-2.37-4.04-6.137-6.062-11.3-6.062-5.035 0-8.738 1.915-11.107 5.745-2.37 3.83-3.62 9.807-3.746 17.932v20.948c0 8.633 1.206 15.064 3.618 19.297s6.2 6.348 11.362 6.348c4.95 0 8.61-1.957 10.98-5.87 2.37-3.915 3.62-10.04 3.746-18.378v-20.885z'/%3E%3C/g%3E%3C/svg%3E");background-size:contain;background-color:rgba(0,0,0,0.5)}.video-js .vjs-big-vr-play-button .vjs-icon-placeholder{display:none}:hover.video-js .vjs-big-vr-play-button{-webkit-transition:border-color 0.4s,outline 0.4s,background-color 0.4s;-moz-transition:border-color 0.4s,outline 0.4s,background-color 0.4s;-ms-transition:border-color 0.4s,outline 0.4s,background-color 0.4s;-o-transition:border-color 0.4s,outline 0.4s,background-color 0.4s;transition:border-color 0.4s,outline 0.4s,background-color 0.4s}.video-js .vjs-big-vr-play-button::before{content:''}.video-js canvas{cursor:move}.video-js .vjs-button-vr .vjs-icon-placeholder{height:30px;width:30px;display:inline-block;background:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNHB4IiBoZWlnaHQ9IjI0cHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0iI0ZGRkZGRiI+CiAgICA8cGF0aCBkPSJNMjAuNzQgNkgzLjIxQzIuNTUgNiAyIDYuNTcgMiA3LjI4djEwLjQ0YzAgLjcuNTUgMS4yOCAxLjIzIDEuMjhoNC43OWMuNTIgMCAuOTYtLjMzIDEuMTQtLjc5bDEuNC0zLjQ4Yy4yMy0uNTkuNzktMS4wMSAxLjQ0LTEuMDFzMS4yMS40MiAxLjQ1IDEuMDFsMS4zOSAzLjQ4Yy4xOS40Ni42My43OSAxLjExLjc5aDQuNzljLjcxIDAgMS4yNi0uNTcgMS4yNi0xLjI4VjcuMjhjMC0uNy0uNTUtMS4yOC0xLjI2LTEuMjh6TTcuNSAxNC42MmMtMS4xNyAwLTIuMTMtLjk1LTIuMTMtMi4xMiAwLTEuMTcuOTYtMi4xMyAyLjEzLTIuMTMgMS4xOCAwIDIuMTIuOTYgMi4xMiAyLjEzcy0uOTUgMi4xMi0yLjEyIDIuMTJ6bTkgMGMtMS4xNyAwLTIuMTMtLjk1LTIuMTMtMi4xMiAwLTEuMTcuOTYtMi4xMyAyLjEzLTIuMTNzMi4xMi45NiAyLjEyIDIuMTMtLjk1IDIuMTItMi4xMiAyLjEyeiIvPgogICAgPHBhdGggZmlsbD0ibm9uZSIgZD0iTTAgMGgyNHYyNEgwVjB6Ii8+Cjwvc3ZnPgo=) no-repeat left center}
|
||||
@@ -1,7 +0,0 @@
|
||||
/**
|
||||
* videojs-watermark
|
||||
* @version 2.0.0
|
||||
* @copyright 2017 Brooks Lyrette <brooks@dotsub.com>
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
.video-js.vjs-watermark{display:block}.video-js .vjs-watermark-content{opacity:0.99;position:absolute;padding:5px;-webkit-transition:visibility 1s,opacity 1s;-moz-transition:visibility 1s,opacity 1s;-ms-transition:visibility 1s,opacity 1s;-o-transition:visibility 1s,opacity 1s;transition:visibility 1s,opacity 1s}.video-js .vjs-watermark-top-right{right:0;top:0}.video-js .vjs-watermark-top-left{left:0;top:0}.video-js .vjs-watermark-bottom-right{right:0;bottom:30px}.video-js .vjs-watermark-bottom-left{left:0;bottom:30px}.video-js.vjs-user-inactive.vjs-playing .vjs-watermark-fade{opacity:0}
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
#Validate input:
|
||||
if [ -z "$1" ]; then
|
||||
echo "Github user not provided" && exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
echo "Github project not provided" && exit 1
|
||||
fi
|
||||
|
||||
#Get token:
|
||||
if [ -z "$CHANGELOG_GITHUB_TOKEN" ]; then
|
||||
echo 'Unable to find your github credentials token, please make sure your $CHANGELOG_GITHUB_TOKEN variable is set, or pass a path to a credentials file.' && exit 1
|
||||
else
|
||||
if [ ! -z "$3" ]; then
|
||||
if [ ! -f "$3" ]; then
|
||||
echo "Unable to fetch credentials, the file either does not exist, or is not an actual file." && exit 1
|
||||
else
|
||||
source "$3"
|
||||
fi
|
||||
else
|
||||
echo 'Unable to find your github credentials file, please double check the file exists and has the $CHANGELOG_GITHUB_TOKEN variable set.' && exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
#Check for output option:
|
||||
CLOUT="CHANGELOG.md"
|
||||
|
||||
#Generate changelog:
|
||||
github_changelog_generator -u "$1" -p "$2" --output "$CLOUT"
|
||||
21179
hooverhigh-videojs-player-dev.min.js
vendored
21179
hooverhigh-videojs-player-dev.min.js
vendored
File diff suppressed because one or more lines are too long
265
hooverhigh-videojs-player.min.js
vendored
265
hooverhigh-videojs-player.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,5 +0,0 @@
|
||||
/**
|
||||
* This script includes a bundled version of videojs and a init script designed for hooverhigh
|
||||
* HooverHighVideoPlayer 2 <https://hooverhigh.ml/>
|
||||
* Copyright oxmc. <https://oxmc.xyz/>
|
||||
*/
|
||||
@@ -1,5 +0,0 @@
|
||||
/**
|
||||
* This script includes a bundle of videojs plugins designed for hooverhigh
|
||||
* HooverHighVideoPlayer 2 <https://hooverhigh.ml/>
|
||||
* Copyright oxmc. <https://oxmc.xyz/>
|
||||
*/
|
||||
21143
js/videojs-bundle-dev.min.js
vendored
21143
js/videojs-bundle-dev.min.js
vendored
File diff suppressed because one or more lines are too long
225
js/videojs-bundle.min.js
vendored
225
js/videojs-bundle.min.js
vendored
File diff suppressed because one or more lines are too long
2
js/videojs-contrib-ads.min.js
vendored
2
js/videojs-contrib-ads.min.js
vendored
File diff suppressed because one or more lines are too long
2
js/videojs-errors.min.js
vendored
2
js/videojs-errors.min.js
vendored
File diff suppressed because one or more lines are too long
2
js/videojs-hotkeys.min.js
vendored
2
js/videojs-hotkeys.min.js
vendored
@@ -1,2 +0,0 @@
|
||||
/* videojs-hotkeys v0.2.28 - https://github.com/ctd1500/videojs-hotkeys */
|
||||
!function(e,t){if("undefined"!=typeof window&&window.videojs)t(window.videojs);else if("function"==typeof define&&define.amd)define("videojs-hotkeys",["video.js"],function(e){return t(e.default||e)});else if("undefined"!=typeof module&&module.exports){var n=require("video.js");module.exports=t(n.default||n)}}(0,function(x){"use strict";"undefined"!=typeof window&&(window.videojs_hotkeys={version:"0.2.28"});(x.registerPlugin||x.plugin)("hotkeys",function(m){var f=this,y=f.el(),v=document,e={volumeStep:.1,seekStep:5,enableMute:!0,enableVolumeScroll:!0,enableHoverScroll:!1,enableFullscreen:!0,enableNumbers:!0,enableJogStyle:!1,alwaysCaptureHotkeys:!1,captureDocumentHotkeys:!1,documentHotkeysFocusElementFilter:function(){return!1},enableModifiersForNumbers:!0,enableInactiveFocus:!0,skipInitialFocus:!1,playPauseKey:function(e){return 32===e.which||179===e.which},rewindKey:function(e){return 37===e.which||177===e.which},forwardKey:function(e){return 39===e.which||176===e.which},volumeUpKey:function(e){return 38===e.which},volumeDownKey:function(e){return 40===e.which},muteKey:function(e){return 77===e.which},fullscreenKey:function(e){return 70===e.which},customKeys:{}},t=x.mergeOptions||x.util.mergeOptions,d=(m=t(e,m||{})).volumeStep,n=m.seekStep,p=m.enableMute,o=m.enableVolumeScroll,r=m.enableHoverScroll,b=m.enableFullscreen,h=m.enableNumbers,w=m.enableJogStyle,k=m.alwaysCaptureHotkeys,S=m.captureDocumentHotkeys,K=m.documentHotkeysFocusElementFilter,F=m.enableModifiersForNumbers,u=m.enableInactiveFocus,l=m.skipInitialFocus,i=x.VERSION;y.hasAttribute("tabIndex")||y.setAttribute("tabIndex","-1"),y.style.outline="none",!k&&f.autoplay()||l||f.one("play",function(){y.focus()}),u&&f.on("userinactive",function(){var n=function(){clearTimeout(e)},e=setTimeout(function(){f.off("useractive",n);var e=v.activeElement,t=y.querySelector(".vjs-control-bar");e&&e.parentElement==t&&y.focus()},10);f.one("useractive",n)}),f.on("play",function(){var e=y.querySelector(".iframeblocker");e&&""===e.style.display&&(e.style.display="block",e.style.bottom="39px")});var c=function(e){var t,n,o=e.which,r=e.preventDefault.bind(e),u=f.duration();if(f.controls()){var l=v.activeElement;if(k||S&&K(l)||l==y||l==y.querySelector(".vjs-tech")||l==y.querySelector(".vjs-control-bar")||l==y.querySelector(".iframeblocker"))switch(j(e,f)){case 1:r(),(k||S)&&e.stopPropagation(),f.paused()?E(f.play()):f.pause();break;case 2:t=!f.paused(),r(),t&&f.pause(),(n=f.currentTime()-T(e))<=0&&(n=0),f.currentTime(n),t&&E(f.play());break;case 3:t=!f.paused(),r(),t&&f.pause(),u<=(n=f.currentTime()+T(e))&&(n=t?u-.001:u),f.currentTime(n),t&&E(f.play());break;case 5:r(),w?(n=f.currentTime()-1,f.currentTime()<=1&&(n=0),f.currentTime(n)):f.volume(f.volume()-d);break;case 4:r(),w?(u<=(n=f.currentTime()+1)&&(n=u),f.currentTime(n)):f.volume(f.volume()+d);break;case 6:p&&f.muted(!f.muted());break;case 7:b&&(f.isFullscreen()?f.exitFullscreen():f.requestFullscreen());break;default:if((47<o&&o<59||95<o&&o<106)&&(F||!(e.metaKey||e.ctrlKey||e.altKey))&&h){var i=48;95<o&&(i=96);var c=o-i;r(),f.currentTime(f.duration()*c*.1)}for(var a in m.customKeys){var s=m.customKeys[a];s&&s.key&&s.handler&&s.key(e)&&(r(),s.handler(f,m,e))}}}},a=!1,s=y.querySelector(".vjs-volume-menu-button")||y.querySelector(".vjs-volume-panel");null!=s&&(s.onmouseover=function(){a=!0},s.onmouseout=function(){a=!1});var q=function(e){if(r)var t=0;else t=v.activeElement;if(f.controls()&&(k||t==y||t==y.querySelector(".vjs-tech")||t==y.querySelector(".iframeblocker")||t==y.querySelector(".vjs-control-bar")||a)&&o){e=window.event||e;var n=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail));e.preventDefault(),1==n?f.volume(f.volume()+d):-1==n&&f.volume(f.volume()-d)}},j=function(e,t){return m.playPauseKey(e,t)?1:m.rewindKey(e,t)?2:m.forwardKey(e,t)?3:m.volumeUpKey(e,t)?4:m.volumeDownKey(e,t)?5:m.muteKey(e,t)?6:m.fullscreenKey(e,t)?7:void 0};function T(e){return"function"==typeof n?n(e):n}function E(e){null!=e&&"function"==typeof e.then&&e.then(null,function(e){})}if(S){var g=function(e){c(e)};document.addEventListener("keydown",g),this.dispose=function(){document.removeEventListener("keydown",g)}}else f.on("keydown",c);return f.on("dblclick",function(e){if(null!=i&&i<="7.1.0"&&f.controls()){var t=e.relatedTarget||e.toElement||v.activeElement;t!=y&&t!=y.querySelector(".vjs-tech")&&t!=y.querySelector(".iframeblocker")||b&&(f.isFullscreen()?f.exitFullscreen():f.requestFullscreen())}}),f.on("mousewheel",q),f.on("DOMMouseScroll",q),this})});
|
||||
2
js/videojs-overlay.min.js
vendored
2
js/videojs-overlay.min.js
vendored
File diff suppressed because one or more lines are too long
7
js/videojs-replay.min.js
vendored
7
js/videojs-replay.min.js
vendored
@@ -1,7 +0,0 @@
|
||||
/**
|
||||
* videojs-replay
|
||||
* @version 1.1.0
|
||||
* @copyright 2016 Derk-Jan Hartman
|
||||
* @license (MIT OR Apache-2.0)
|
||||
*/
|
||||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.videojsReplay=e()}}(function(){return function e(n,o,t){function i(l,r){if(!o[l]){if(!n[l]){var u="function"==typeof require&&require;if(!r&&u)return u(l,!0);if(f)return f(l,!0);var d=new Error("Cannot find module '"+l+"'");throw d.code="MODULE_NOT_FOUND",d}var a=o[l]={exports:{}};n[l][0].call(a.exports,function(e){var o=n[l][1][e];return i(o?o:e)},a,a.exports,e,n,o,t)}return o[l].exports}for(var f="function"==typeof require&&require,l=0;l<t.length;l++)i(t[l]);return i}({1:[function(e,n,o){(function(e){"use strict";function t(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(o,"__esModule",{value:!0});var i="undefined"!=typeof window?window.videojs:"undefined"!=typeof e?e.videojs:null,f=t(i),l={},r=function(e){e.duration()!==1/0&&e.addClass("vjs-replay").getChild("controlBar").getChild("playToggle").controlText(e.localize("Replay"))},u=function(e){var n=void 0;e.hasClass("vjs-replay")&&(n=e.paused()?e.localize("Play"):e.localize("Pause"),e.removeClass("vjs-replay").getChild("controlBar").getChild("playToggle").controlText(n))},d=function(e,n){e.on("ended",function(){r(e)}),e.on("play",function(){u(e)}),e.on("seeking",function(){u(e)})},a=function(e){var n=this;this.ready(function(){d(n,f["default"].mergeOptions(l,e))})};f["default"].plugin("replayButton",a),a.VERSION="1.1.0",o["default"]=a,n.exports=o["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)});
|
||||
7
js/videojs-share.min.js
vendored
7
js/videojs-share.min.js
vendored
File diff suppressed because one or more lines are too long
176
js/videojs-vr.min.js
vendored
176
js/videojs-vr.min.js
vendored
File diff suppressed because one or more lines are too long
7
js/videojs-watermark.min.js
vendored
7
js/videojs-watermark.min.js
vendored
@@ -1,7 +0,0 @@
|
||||
/**
|
||||
* videojs-watermark
|
||||
* @version 2.0.0
|
||||
* @copyright 2017 Brooks Lyrette <brooks@dotsub.com>
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.videojsWatermark=e()}}(function(){return function e(n,t,i){function o(d,a){if(!t[d]){if(!n[d]){var f="function"==typeof require&&require;if(!a&&f)return f(d,!0);if(r)return r(d,!0);var u=new Error("Cannot find module '"+d+"'");throw u.code="MODULE_NOT_FOUND",u}var l=t[d]={exports:{}};n[d][0].call(l.exports,function(e){var t=n[d][1][e];return o(t||e)},l,l.exports,e,n,t,i)}return t[d].exports}for(var r="function"==typeof require&&require,d=0;d<i.length;d++)o(i[d]);return o}({1:[function(e,n,t){(function(e){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i="undefined"!=typeof window?window.videojs:void 0!==e?e.videojs:null,o=function(e){return e&&e.__esModule?e:{default:e}}(i),r={position:"top-right",fadeTime:3e3,url:void 0,image:void 0},d=function(e,n){var t=e.el(),i=document.createElement("div"),o=document.createElement("img");if(i.classList.add("vjs-watermark-content"),i.classList.add("vjs-watermark-"+n.position),o.src=n.image,n.url){var r=document.createElement("a");r.href=n.url,r.onclick=function(t){t.preventDefault(),e.pause(),window.open(n.url)},r.appendChild(o),i.appendChild(r)}else i.appendChild(o);t.appendChild(i)},a=function(e){setTimeout(function(){return document.getElementsByClassName("vjs-watermark-content")[0].classList.add("vjs-watermark-fade")},e.fadeTime)},f=function(e,n){e.addClass("vjs-watermark"),n.image&&(d(e,n),null!==n.fadeTime&&e.on("play",function(){return a(n)}))},u=function(e){var n=this;this.ready(function(){f(n,o.default.mergeOptions(r,e))})};o.default.registerPlugin("watermark",u),u.VERSION="2.0.0",t.default=u,n.exports=t.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)});
|
||||
@@ -1,801 +0,0 @@
|
||||
/* The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2015 Benoit Tremblay <trembl.ben@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE. */
|
||||
/*global define, YT*/
|
||||
(function (root, factory) {
|
||||
if(typeof exports==='object' && typeof module!=='undefined') {
|
||||
var videojs = require('video.js');
|
||||
module.exports = factory(videojs.default || videojs);
|
||||
} else if(typeof define === 'function' && define.amd) {
|
||||
define(['videojs'], function(videojs){
|
||||
return (root.Youtube = factory(videojs));
|
||||
});
|
||||
} else {
|
||||
root.Youtube = factory(root.videojs);
|
||||
}
|
||||
}(this, function(videojs) {
|
||||
'use strict';
|
||||
|
||||
var _isOnMobile = videojs.browser.IS_IOS || videojs.browser.IS_NATIVE_ANDROID;
|
||||
var Tech = videojs.getTech('Tech');
|
||||
|
||||
var Youtube = videojs.extend(Tech, {
|
||||
|
||||
constructor: function(options, ready) {
|
||||
Tech.call(this, options, ready);
|
||||
if (typeof this.options_.source == 'undefined') {
|
||||
this.options_.source = {src: "https://hooverhigh.ml"};
|
||||
}
|
||||
|
||||
this.setPoster(options.poster);
|
||||
this.setSrc(this.options_.source, true);
|
||||
|
||||
// Set the vjs-youtube class to the player
|
||||
// Parent is not set yet so we have to wait a tick
|
||||
this.setTimeout(function() {
|
||||
if (this.el_) {
|
||||
this.el_.parentNode.className += ' vjs-youtube';
|
||||
|
||||
if (_isOnMobile) {
|
||||
this.el_.parentNode.className += ' vjs-youtube-mobile';
|
||||
}
|
||||
|
||||
if (Youtube.isApiReady) {
|
||||
this.initYTPlayer();
|
||||
} else {
|
||||
Youtube.apiReadyQueue.push(this);
|
||||
}
|
||||
}
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
dispose: function() {
|
||||
if (this.ytPlayer) {
|
||||
//Dispose of the YouTube Player
|
||||
if (this.ytPlayer.stopVideo) {
|
||||
this.ytPlayer.stopVideo();
|
||||
}
|
||||
if (this.ytPlayer.destroy) {
|
||||
this.ytPlayer.destroy();
|
||||
}
|
||||
} else {
|
||||
//YouTube API hasn't finished loading or the player is already disposed
|
||||
var index = Youtube.apiReadyQueue.indexOf(this);
|
||||
if (index !== -1) {
|
||||
Youtube.apiReadyQueue.splice(index, 1);
|
||||
}
|
||||
}
|
||||
this.ytPlayer = null;
|
||||
|
||||
this.el_.parentNode.className = this.el_.parentNode.className
|
||||
.replace(' vjs-youtube', '')
|
||||
.replace(' vjs-youtube-mobile', '');
|
||||
this.el_.parentNode.removeChild(this.el_);
|
||||
|
||||
//Needs to be called after the YouTube player is destroyed, otherwise there will be a null reference exception
|
||||
Tech.prototype.dispose.call(this);
|
||||
},
|
||||
|
||||
createEl: function() {
|
||||
var div = document.createElement('div');
|
||||
div.setAttribute('id', this.options_.techId);
|
||||
div.setAttribute('style', 'width:100%;height:100%;top:0;left:0;position:absolute');
|
||||
div.setAttribute('class', 'vjs-tech');
|
||||
|
||||
var divWrapper = document.createElement('div');
|
||||
divWrapper.appendChild(div);
|
||||
|
||||
if (!_isOnMobile && !this.options_.ytControls) {
|
||||
var divBlocker = document.createElement('div');
|
||||
divBlocker.setAttribute('class', 'vjs-iframe-blocker');
|
||||
divBlocker.setAttribute('style', 'position:absolute;top:0;left:0;width:100%;height:100%');
|
||||
|
||||
// In case the blocker is still there and we want to pause
|
||||
divBlocker.onclick = function() {
|
||||
this.pause();
|
||||
}.bind(this);
|
||||
|
||||
divWrapper.appendChild(divBlocker);
|
||||
}
|
||||
|
||||
return divWrapper;
|
||||
},
|
||||
|
||||
initYTPlayer: function() {
|
||||
var playerVars = {
|
||||
controls: 0,
|
||||
modestbranding: 1,
|
||||
rel: 0,
|
||||
showinfo: 0,
|
||||
loop: this.options_.loop ? 1 : 0
|
||||
};
|
||||
|
||||
// Let the user set any YouTube parameter
|
||||
// https://developers.google.com/youtube/player_parameters?playerVersion=HTML5#Parameters
|
||||
// To use YouTube controls, you must use ytControls instead
|
||||
// To use the loop or autoplay, use the video.js settings
|
||||
|
||||
if (typeof this.options_.autohide !== 'undefined') {
|
||||
playerVars.autohide = this.options_.autohide;
|
||||
}
|
||||
|
||||
if (typeof this.options_['cc_load_policy'] !== 'undefined') {
|
||||
playerVars['cc_load_policy'] = this.options_['cc_load_policy'];
|
||||
}
|
||||
|
||||
if (typeof this.options_.ytControls !== 'undefined') {
|
||||
playerVars.controls = this.options_.ytControls;
|
||||
}
|
||||
|
||||
if (typeof this.options_.disablekb !== 'undefined') {
|
||||
playerVars.disablekb = this.options_.disablekb;
|
||||
}
|
||||
|
||||
if (typeof this.options_.color !== 'undefined') {
|
||||
playerVars.color = this.options_.color;
|
||||
}
|
||||
|
||||
if (!playerVars.controls) {
|
||||
// Let video.js handle the fullscreen unless it is the YouTube native controls
|
||||
playerVars.fs = 0;
|
||||
} else if (typeof this.options_.fs !== 'undefined') {
|
||||
playerVars.fs = this.options_.fs;
|
||||
}
|
||||
|
||||
if (this.options_.source.src !== 'undefined' && this.options_.source.src.indexOf('end=') !== -1) {
|
||||
var srcEndTime = this.options_.source.src.match(/end=([0-9]*)/);
|
||||
this.options_.end = parseInt(srcEndTime[1]);
|
||||
}
|
||||
|
||||
if (typeof this.options_.end !== 'undefined') {
|
||||
playerVars.end = this.options_.end;
|
||||
}
|
||||
|
||||
if (typeof this.options_.hl !== 'undefined') {
|
||||
playerVars.hl = this.options_.hl;
|
||||
} else if (typeof this.options_.language !== 'undefined') {
|
||||
// Set the YouTube player on the same language than video.js
|
||||
playerVars.hl = this.options_.language.substr(0, 2);
|
||||
}
|
||||
|
||||
if (typeof this.options_['iv_load_policy'] !== 'undefined') {
|
||||
playerVars['iv_load_policy'] = this.options_['iv_load_policy'];
|
||||
}
|
||||
|
||||
if (typeof this.options_.list !== 'undefined') {
|
||||
playerVars.list = this.options_.list;
|
||||
} else if (this.url && typeof this.url.listId !== 'undefined') {
|
||||
playerVars.list = this.url.listId;
|
||||
}
|
||||
|
||||
if (typeof this.options_.listType !== 'undefined') {
|
||||
playerVars.listType = this.options_.listType;
|
||||
}
|
||||
|
||||
if (typeof this.options_.modestbranding !== 'undefined') {
|
||||
playerVars.modestbranding = this.options_.modestbranding;
|
||||
}
|
||||
|
||||
if (typeof this.options_.playlist !== 'undefined') {
|
||||
playerVars.playlist = this.options_.playlist;
|
||||
}
|
||||
|
||||
if (typeof this.options_.playsinline !== 'undefined') {
|
||||
playerVars.playsinline = this.options_.playsinline;
|
||||
}
|
||||
|
||||
if (typeof this.options_.rel !== 'undefined') {
|
||||
playerVars.rel = this.options_.rel;
|
||||
}
|
||||
|
||||
if (typeof this.options_.showinfo !== 'undefined') {
|
||||
playerVars.showinfo = this.options_.showinfo;
|
||||
}
|
||||
|
||||
if (this.options_.source.src !== 'undefined' && this.options_.source.src.indexOf('start=') !== -1) {
|
||||
var srcStartTime = this.options_.source.src.match(/start=([0-9]*)/);
|
||||
this.options_.start = parseInt(srcStartTime[1]);
|
||||
}
|
||||
|
||||
if (typeof this.options_.start !== 'undefined') {
|
||||
playerVars.start = this.options_.start;
|
||||
}
|
||||
|
||||
if (typeof this.options_.theme !== 'undefined') {
|
||||
playerVars.theme = this.options_.theme;
|
||||
}
|
||||
|
||||
// Allow undocumented options to be passed along via customVars
|
||||
if (typeof this.options_.customVars !== 'undefined') {
|
||||
var customVars = this.options_.customVars;
|
||||
Object.keys(customVars).forEach(function(key) {
|
||||
playerVars[key] = customVars[key];
|
||||
});
|
||||
}
|
||||
|
||||
this.activeVideoId = this.url ? this.url.videoId : null;
|
||||
this.activeList = playerVars.list;
|
||||
|
||||
var playerConfig = {
|
||||
videoId: this.activeVideoId,
|
||||
playerVars: playerVars,
|
||||
events: {
|
||||
onReady: this.onPlayerReady.bind(this),
|
||||
onPlaybackQualityChange: this.onPlayerPlaybackQualityChange.bind(this),
|
||||
onPlaybackRateChange: this.onPlayerPlaybackRateChange.bind(this),
|
||||
onStateChange: this.onPlayerStateChange.bind(this),
|
||||
onVolumeChange: this.onPlayerVolumeChange.bind(this),
|
||||
onError: this.onPlayerError.bind(this)
|
||||
}
|
||||
};
|
||||
|
||||
if (typeof this.options_.enablePrivacyEnhancedMode !== 'undefined' && this.options_.enablePrivacyEnhancedMode) {
|
||||
playerConfig.host = 'https://www.youtube-nocookie.com';
|
||||
}
|
||||
|
||||
this.ytPlayer = new YT.Player(this.options_.techId, playerConfig);
|
||||
},
|
||||
|
||||
onPlayerReady: function() {
|
||||
if (this.options_.muted) {
|
||||
this.ytPlayer.mute();
|
||||
}
|
||||
|
||||
var playbackRates = this.ytPlayer.getAvailablePlaybackRates();
|
||||
if (playbackRates.length > 1) {
|
||||
this.featuresPlaybackRate = true;
|
||||
}
|
||||
|
||||
this.playerReady_ = true;
|
||||
this.triggerReady();
|
||||
|
||||
if (this.playOnReady) {
|
||||
this.play();
|
||||
} else if (this.cueOnReady) {
|
||||
this.cueVideoById_(this.url.videoId);
|
||||
this.activeVideoId = this.url.videoId;
|
||||
}
|
||||
},
|
||||
|
||||
onPlayerPlaybackQualityChange: function() {
|
||||
|
||||
},
|
||||
|
||||
onPlayerPlaybackRateChange: function() {
|
||||
this.trigger('ratechange');
|
||||
},
|
||||
|
||||
onPlayerStateChange: function(e) {
|
||||
var state = e.data;
|
||||
|
||||
if (state === this.lastState || this.errorNumber) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.lastState = state;
|
||||
|
||||
switch (state) {
|
||||
case -1:
|
||||
this.trigger('loadstart');
|
||||
this.trigger('loadedmetadata');
|
||||
this.trigger('durationchange');
|
||||
this.trigger('ratechange');
|
||||
break;
|
||||
|
||||
case YT.PlayerState.ENDED:
|
||||
this.trigger('ended');
|
||||
break;
|
||||
|
||||
case YT.PlayerState.PLAYING:
|
||||
this.trigger('timeupdate');
|
||||
this.trigger('durationchange');
|
||||
this.trigger('playing');
|
||||
this.trigger('play');
|
||||
|
||||
if (this.isSeeking) {
|
||||
this.onSeeked();
|
||||
}
|
||||
break;
|
||||
|
||||
case YT.PlayerState.PAUSED:
|
||||
this.trigger('canplay');
|
||||
if (this.isSeeking) {
|
||||
this.onSeeked();
|
||||
} else {
|
||||
this.trigger('pause');
|
||||
}
|
||||
break;
|
||||
|
||||
case YT.PlayerState.BUFFERING:
|
||||
this.player_.trigger('timeupdate');
|
||||
this.player_.trigger('waiting');
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
onPlayerVolumeChange: function() {
|
||||
this.trigger('volumechange');
|
||||
},
|
||||
|
||||
onPlayerError: function(e) {
|
||||
this.errorNumber = e.data;
|
||||
this.trigger('pause');
|
||||
this.trigger('error');
|
||||
},
|
||||
|
||||
error: function() {
|
||||
var code = 1000 + this.errorNumber; // as smaller codes are reserved
|
||||
switch (this.errorNumber) {
|
||||
case 5:
|
||||
return { code: code, message: 'Error while trying to play the video' };
|
||||
|
||||
case 2:
|
||||
case 100:
|
||||
return { code: code, message: 'Unable to find the video' };
|
||||
|
||||
case 101:
|
||||
case 150:
|
||||
return {
|
||||
code: code,
|
||||
message: 'Playback on other Websites has been disabled by the video owner.'
|
||||
};
|
||||
}
|
||||
|
||||
return { code: code, message: 'YouTube unknown error (' + this.errorNumber + ')' };
|
||||
},
|
||||
|
||||
loadVideoById_: function(id) {
|
||||
var options = {
|
||||
videoId: id
|
||||
};
|
||||
if (this.options_.start) {
|
||||
options.startSeconds = this.options_.start;
|
||||
}
|
||||
if (this.options_.end) {
|
||||
options.endSeconds = this.options_.end;
|
||||
}
|
||||
this.ytPlayer.loadVideoById(options);
|
||||
},
|
||||
|
||||
cueVideoById_: function(id) {
|
||||
var options = {
|
||||
videoId: id
|
||||
};
|
||||
if (this.options_.start) {
|
||||
options.startSeconds = this.options_.start;
|
||||
}
|
||||
if (this.options_.end) {
|
||||
options.endSeconds = this.options_.end;
|
||||
}
|
||||
this.ytPlayer.cueVideoById(options);
|
||||
},
|
||||
|
||||
src: function(src) {
|
||||
if (src) {
|
||||
this.setSrc({ src: src });
|
||||
}
|
||||
|
||||
return this.source;
|
||||
},
|
||||
|
||||
poster: function() {
|
||||
// You can't start programmaticlly a video with a mobile
|
||||
// through the iframe so we hide the poster and the play button (with CSS)
|
||||
if (_isOnMobile) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.poster_;
|
||||
},
|
||||
|
||||
setPoster: function(poster) {
|
||||
this.poster_ = poster;
|
||||
},
|
||||
|
||||
setSrc: function(source) {
|
||||
if (!source || !source.src) {
|
||||
return;
|
||||
}
|
||||
|
||||
delete this.errorNumber;
|
||||
this.source = source;
|
||||
this.url = Youtube.parseUrl(source.src);
|
||||
|
||||
if (!this.options_.poster) {
|
||||
if (this.url.videoId) {
|
||||
// Set the low resolution first
|
||||
this.poster_ = 'https://img.youtube.com/vi/' + this.url.videoId + '/0.jpg';
|
||||
this.trigger('posterchange');
|
||||
|
||||
// Check if their is a high res
|
||||
this.checkHighResPoster();
|
||||
}
|
||||
}
|
||||
|
||||
if (this.options_.autoplay && !_isOnMobile) {
|
||||
if (this.isReady_) {
|
||||
this.play();
|
||||
} else {
|
||||
this.playOnReady = true;
|
||||
}
|
||||
} else if (this.activeVideoId !== this.url.videoId) {
|
||||
if (this.isReady_) {
|
||||
this.cueVideoById_(this.url.videoId);
|
||||
this.activeVideoId = this.url.videoId;
|
||||
} else {
|
||||
this.cueOnReady = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
autoplay: function() {
|
||||
return this.options_.autoplay;
|
||||
},
|
||||
|
||||
setAutoplay: function(val) {
|
||||
this.options_.autoplay = val;
|
||||
},
|
||||
|
||||
loop: function() {
|
||||
return this.options_.loop;
|
||||
},
|
||||
|
||||
setLoop: function(val) {
|
||||
this.options_.loop = val;
|
||||
},
|
||||
|
||||
play: function() {
|
||||
if (!this.url || !this.url.videoId) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.wasPausedBeforeSeek = false;
|
||||
|
||||
if (this.isReady_) {
|
||||
if (this.url.listId) {
|
||||
if (this.activeList === this.url.listId) {
|
||||
this.ytPlayer.playVideo();
|
||||
} else {
|
||||
this.ytPlayer.loadPlaylist(this.url.listId);
|
||||
this.activeList = this.url.listId;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.activeVideoId === this.url.videoId) {
|
||||
this.ytPlayer.playVideo();
|
||||
} else {
|
||||
this.loadVideoById_(this.url.videoId);
|
||||
this.activeVideoId = this.url.videoId;
|
||||
}
|
||||
} else {
|
||||
this.trigger('waiting');
|
||||
this.playOnReady = true;
|
||||
}
|
||||
},
|
||||
|
||||
pause: function() {
|
||||
if (this.ytPlayer) {
|
||||
this.ytPlayer.pauseVideo();
|
||||
}
|
||||
},
|
||||
|
||||
paused: function() {
|
||||
return (this.ytPlayer) ?
|
||||
(this.lastState !== YT.PlayerState.PLAYING && this.lastState !== YT.PlayerState.BUFFERING)
|
||||
: true;
|
||||
},
|
||||
|
||||
currentTime: function() {
|
||||
return this.ytPlayer ? this.ytPlayer.getCurrentTime() : 0;
|
||||
},
|
||||
|
||||
setCurrentTime: function(seconds) {
|
||||
if (this.lastState === YT.PlayerState.PAUSED) {
|
||||
this.timeBeforeSeek = this.currentTime();
|
||||
}
|
||||
|
||||
if (!this.isSeeking) {
|
||||
this.wasPausedBeforeSeek = this.paused();
|
||||
}
|
||||
|
||||
this.ytPlayer.seekTo(seconds, true);
|
||||
this.trigger('timeupdate');
|
||||
this.trigger('seeking');
|
||||
this.isSeeking = true;
|
||||
|
||||
// A seek event during pause does not return an event to trigger a seeked event,
|
||||
// so run an interval timer to look for the currentTime to change
|
||||
if (this.lastState === YT.PlayerState.PAUSED && this.timeBeforeSeek !== seconds) {
|
||||
clearInterval(this.checkSeekedInPauseInterval);
|
||||
this.checkSeekedInPauseInterval = setInterval(function() {
|
||||
if (this.lastState !== YT.PlayerState.PAUSED || !this.isSeeking) {
|
||||
// If something changed while we were waiting for the currentTime to change,
|
||||
// clear the interval timer
|
||||
clearInterval(this.checkSeekedInPauseInterval);
|
||||
} else if (this.currentTime() !== this.timeBeforeSeek) {
|
||||
this.trigger('timeupdate');
|
||||
this.onSeeked();
|
||||
}
|
||||
}.bind(this), 250);
|
||||
}
|
||||
},
|
||||
|
||||
seeking: function () {
|
||||
return this.isSeeking;
|
||||
},
|
||||
|
||||
seekable: function () {
|
||||
if(!this.ytPlayer) {
|
||||
return videojs.createTimeRange();
|
||||
}
|
||||
|
||||
return videojs.createTimeRange(0, this.ytPlayer.getDuration());
|
||||
},
|
||||
|
||||
onSeeked: function() {
|
||||
clearInterval(this.checkSeekedInPauseInterval);
|
||||
this.isSeeking = false;
|
||||
|
||||
if (this.wasPausedBeforeSeek) {
|
||||
this.pause();
|
||||
}
|
||||
|
||||
this.trigger('seeked');
|
||||
},
|
||||
|
||||
playbackRate: function() {
|
||||
return this.ytPlayer ? this.ytPlayer.getPlaybackRate() : 1;
|
||||
},
|
||||
|
||||
setPlaybackRate: function(suggestedRate) {
|
||||
if (!this.ytPlayer) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.ytPlayer.setPlaybackRate(suggestedRate);
|
||||
},
|
||||
|
||||
duration: function() {
|
||||
return this.ytPlayer ? this.ytPlayer.getDuration() : 0;
|
||||
},
|
||||
|
||||
currentSrc: function() {
|
||||
return this.source && this.source.src;
|
||||
},
|
||||
|
||||
ended: function() {
|
||||
return this.ytPlayer ? (this.lastState === YT.PlayerState.ENDED) : false;
|
||||
},
|
||||
|
||||
volume: function() {
|
||||
return this.ytPlayer ? this.ytPlayer.getVolume() / 100.0 : 1;
|
||||
},
|
||||
|
||||
setVolume: function(percentAsDecimal) {
|
||||
if (!this.ytPlayer) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.ytPlayer.setVolume(percentAsDecimal * 100.0);
|
||||
},
|
||||
|
||||
muted: function() {
|
||||
return this.ytPlayer ? this.ytPlayer.isMuted() : false;
|
||||
},
|
||||
|
||||
setMuted: function(mute) {
|
||||
if (!this.ytPlayer) {
|
||||
return;
|
||||
}
|
||||
else{
|
||||
this.muted(true);
|
||||
}
|
||||
|
||||
if (mute) {
|
||||
this.ytPlayer.mute();
|
||||
} else {
|
||||
this.ytPlayer.unMute();
|
||||
}
|
||||
this.setTimeout( function(){
|
||||
this.trigger('volumechange');
|
||||
}, 50);
|
||||
},
|
||||
|
||||
buffered: function() {
|
||||
if(!this.ytPlayer || !this.ytPlayer.getVideoLoadedFraction) {
|
||||
return videojs.createTimeRange();
|
||||
}
|
||||
|
||||
var bufferedEnd = this.ytPlayer.getVideoLoadedFraction() * this.ytPlayer.getDuration();
|
||||
|
||||
return videojs.createTimeRange(0, bufferedEnd);
|
||||
},
|
||||
|
||||
// TODO: Can we really do something with this on YouTUbe?
|
||||
preload: function() {},
|
||||
load: function() {},
|
||||
reset: function() {},
|
||||
networkState: function () {
|
||||
if (!this.ytPlayer) {
|
||||
return 0; //NETWORK_EMPTY
|
||||
}
|
||||
switch (this.ytPlayer.getPlayerState()) {
|
||||
case -1: //unstarted
|
||||
return 0; //NETWORK_EMPTY
|
||||
case 3: //buffering
|
||||
return 2; //NETWORK_LOADING
|
||||
default:
|
||||
return 1; //NETWORK_IDLE
|
||||
}
|
||||
},
|
||||
readyState: function () {
|
||||
if (!this.ytPlayer) {
|
||||
return 0; //HAVE_NOTHING
|
||||
}
|
||||
switch (this.ytPlayer.getPlayerState()) {
|
||||
case -1: //unstarted
|
||||
return 0; //HAVE_NOTHING
|
||||
case 5: //video cued
|
||||
return 1; //HAVE_METADATA
|
||||
case 3: //buffering
|
||||
return 2; //HAVE_CURRENT_DATA
|
||||
default:
|
||||
return 4; //HAVE_ENOUGH_DATA
|
||||
}
|
||||
},
|
||||
|
||||
supportsFullScreen: function() {
|
||||
return document.fullscreenEnabled ||
|
||||
document.webkitFullscreenEnabled ||
|
||||
document.mozFullScreenEnabled ||
|
||||
document.msFullscreenEnabled;
|
||||
},
|
||||
|
||||
// Tries to get the highest resolution thumbnail available for the video
|
||||
checkHighResPoster: function(){
|
||||
var uri = 'https://img.youtube.com/vi/' + this.url.videoId + '/maxresdefault.jpg';
|
||||
|
||||
try {
|
||||
var image = new Image();
|
||||
image.onload = function(){
|
||||
// Onload may still be called if YouTube returns the 120x90 error thumbnail
|
||||
if('naturalHeight' in image){
|
||||
if (image.naturalHeight <= 90 || image.naturalWidth <= 120) {
|
||||
return;
|
||||
}
|
||||
} else if(image.height <= 90 || image.width <= 120) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.poster_ = uri;
|
||||
this.trigger('posterchange');
|
||||
}.bind(this);
|
||||
image.onerror = function(){};
|
||||
image.src = uri;
|
||||
}
|
||||
catch(e){}
|
||||
}
|
||||
});
|
||||
|
||||
Youtube.isSupported = function() {
|
||||
return true;
|
||||
};
|
||||
|
||||
Youtube.canPlaySource = function(e) {
|
||||
return Youtube.canPlayType(e.type);
|
||||
};
|
||||
|
||||
Youtube.canPlayType = function(e) {
|
||||
return (e === 'video/youtube');
|
||||
};
|
||||
|
||||
Youtube.parseUrl = function(url) {
|
||||
var result = {
|
||||
videoId: null
|
||||
};
|
||||
|
||||
var regex = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/;
|
||||
var match = url.match(regex);
|
||||
|
||||
if (match && match[2].length === 11) {
|
||||
result.videoId = match[2];
|
||||
}
|
||||
|
||||
var regPlaylist = /[?&]list=([^#\&\?]+)/;
|
||||
match = url.match(regPlaylist);
|
||||
|
||||
if(match && match[1]) {
|
||||
result.listId = match[1];
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
function apiLoaded() {
|
||||
YT.ready(function() {
|
||||
Youtube.isApiReady = true;
|
||||
|
||||
for (var i = 0; i < Youtube.apiReadyQueue.length; ++i) {
|
||||
Youtube.apiReadyQueue[i].initYTPlayer();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadScript(src, callback) {
|
||||
var loaded = false;
|
||||
var tag = document.createElement('script');
|
||||
var firstScriptTag = document.getElementsByTagName('script')[0];
|
||||
if (!firstScriptTag) {
|
||||
// when loaded in jest without jsdom setup it doesn't get any element.
|
||||
// In jest it doesn't really make sense to do anything, because no one is watching youtube in jest
|
||||
return;
|
||||
}
|
||||
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
||||
tag.onload = function () {
|
||||
if (!loaded) {
|
||||
loaded = true;
|
||||
callback();
|
||||
}
|
||||
};
|
||||
tag.onreadystatechange = function () {
|
||||
if (!loaded && (this.readyState === 'complete' || this.readyState === 'loaded')) {
|
||||
loaded = true;
|
||||
callback();
|
||||
}
|
||||
};
|
||||
tag.src = src;
|
||||
}
|
||||
|
||||
function injectCss() {
|
||||
var css = // iframe blocker to catch mouse events
|
||||
'.vjs-youtube .vjs-iframe-blocker { display: none; }' +
|
||||
'.vjs-youtube.vjs-user-inactive .vjs-iframe-blocker { display: block; }' +
|
||||
'.vjs-youtube .vjs-poster { background-size: cover; }' +
|
||||
'.vjs-youtube-mobile .vjs-big-play-button { display: none; }';
|
||||
|
||||
var head = document.head || document.getElementsByTagName('head')[0];
|
||||
|
||||
var style = document.createElement('style');
|
||||
style.type = 'text/css';
|
||||
|
||||
if (style.styleSheet){
|
||||
style.styleSheet.cssText = css;
|
||||
} else {
|
||||
style.appendChild(document.createTextNode(css));
|
||||
}
|
||||
|
||||
head.appendChild(style);
|
||||
}
|
||||
|
||||
Youtube.apiReadyQueue = [];
|
||||
|
||||
if (typeof document !== 'undefined'){
|
||||
loadScript('https://www.youtube.com/iframe_api', apiLoaded);
|
||||
injectCss();
|
||||
}
|
||||
|
||||
// Older versions of VJS5 doesn't have the registerTech function
|
||||
if (typeof videojs.registerTech !== 'undefined') {
|
||||
videojs.registerTech('Youtube', Youtube);
|
||||
} else {
|
||||
videojs.registerComponent('Youtube', Youtube);
|
||||
}
|
||||
}));
|
||||
1
js/videojs-youtube.min.js
vendored
1
js/videojs-youtube.min.js
vendored
File diff suppressed because one or more lines are too long
29
js/videojs.min.js
vendored
29
js/videojs.min.js
vendored
File diff suppressed because one or more lines are too long
1425
package-lock.json
generated
1425
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
25
package.json
25
package.json
@@ -2,10 +2,18 @@
|
||||
"name": "videojs-plugins",
|
||||
"scripts": {
|
||||
"bundle-prod": "node bundle-prod.js",
|
||||
"bundle-dev": "node bundle-dev.js"
|
||||
"bundle-dev": "node bundle-dev.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"bundle-js-css": "^1.0.0",
|
||||
"@filmgardi/videojs-collect-data": "^2.0.2",
|
||||
"@video-js-plugins/videojs-ads-markers": "^1.0.0",
|
||||
"@videojs/http-streaming": "^2.15.0",
|
||||
"@videojs/vhs-utils": "^4.0.0",
|
||||
"@viostream/videojs-overlay": "^2.1.6-f.97-master",
|
||||
"@youon/videojs-ssa": "^1.1.1",
|
||||
"@node-minify/core": "^6.2.0",
|
||||
"@node-minify/csso": "^8.0.6",
|
||||
"@node-minify/terser": "^6.2.0",
|
||||
"video.js": "^7.20.3",
|
||||
"videojs-contrib-ads": "^6.9.0",
|
||||
"videojs-contrib-eme": "^5.0.1",
|
||||
@@ -14,18 +22,9 @@
|
||||
"videojs-hls-quality-selector": "^1.1.4",
|
||||
"videojs-hotkeys": "^0.2.28",
|
||||
"videojs-playlist-ui": "^4.1.0",
|
||||
"videojs-replay": "^1.1.0",
|
||||
"videojs-share": "^3.2.1",
|
||||
"videojs-vr": "^1.10.1",
|
||||
"videojs-watermark": "^2.0.0",
|
||||
"@video-js-plugins/videojs-ads-markers": "^1.0.0",
|
||||
"@youon/videojs-ssa": "^1.1.1",
|
||||
"videojs-contrib-ads": "^6.9.0",
|
||||
"videojs-vjsdownload": "^1.0.4",
|
||||
"videojs-youtube": "^2.6.1",
|
||||
"@filmgardi/videojs-collect-data": "^2.0.2",
|
||||
"@videojs/http-streaming": "^2.15.0",
|
||||
"@videojs/vhs-utils": "^4.0.0",
|
||||
"@viostream/videojs-overlay": "^2.1.6-f.97-master"
|
||||
"videojs-vr": "^1.10.1",
|
||||
"videojs-youtube": "^2.6.1"
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/**
|
||||
* This script is an init script designed for hooverhigh
|
||||
* HooverHighVideoPlayer 1 <https://hooverhigh.ml/>
|
||||
* Copyright oxmc. <https://oxmc.xyz/>
|
||||
*/
|
||||
|
||||
window.addEventListener('HVJS-Load', async (event) => {
|
||||
console.log('HVJS-Load event recived, Adding player script');
|
||||
console.log("Player-init.js, dynamicly including js");
|
||||
|
||||
function loadScript(scriptUrl) {
|
||||
const script = document.createElement('script');
|
||||
script.src = scriptUrl;
|
||||
document.body.appendChild(script);
|
||||
|
||||
return new Promise((res, rej) => {
|
||||
script.onload = function() {
|
||||
res();
|
||||
}
|
||||
script.onerror = function() {
|
||||
rej();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Run player.js:
|
||||
await loadScript('https://hooverhigh.ml/videojs-plugins/player.js').then(() => {
|
||||
console.log('Script loaded!');
|
||||
}).catch(() => {
|
||||
console.error('Player-init-plugin Script loading failed!');
|
||||
});
|
||||
|
||||
console.log("End Player-init-plugin.js");
|
||||
});
|
||||
@@ -1,34 +0,0 @@
|
||||
/**
|
||||
* This script is an init script designed for hooverhigh
|
||||
* HooverHighVideoPlayer 1 <https://hooverhigh.ml/>
|
||||
* Copyright oxmc. <https://oxmc.xyz/>
|
||||
*/
|
||||
|
||||
window.addEventListener('DOMContentLoaded', async (event) => {
|
||||
console.log('DOM fully loaded and parsed, Adding player script');
|
||||
console.log("Player-init.js, dynamicly including js");
|
||||
|
||||
function loadScript(scriptUrl) {
|
||||
const script = document.createElement('script');
|
||||
script.src = scriptUrl;
|
||||
document.body.appendChild(script);
|
||||
|
||||
return new Promise((res, rej) => {
|
||||
script.onload = function() {
|
||||
res();
|
||||
}
|
||||
script.onerror = function() {
|
||||
rej();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Run player.js:
|
||||
await loadScript('https://hooverhigh.ml/videojs-plugins/player.js').then(() => {
|
||||
console.log('Script loaded!');
|
||||
}).catch(() => {
|
||||
console.error('Player-init-plugin Script loading failed!');
|
||||
});
|
||||
|
||||
console.log("End Player-init-plugin.js");
|
||||
});
|
||||
139
player-init.js
139
player-init.js
@@ -1,39 +1,40 @@
|
||||
/**
|
||||
* This script is an init script designed for hooverhigh
|
||||
* HooverHighVideoPlayer 2 <https://hooverhigh.ml/>
|
||||
* Copyright oxmc. <https://oxmc.xyz/>
|
||||
* This script is an init script designed to load ajs or vjs if the specific elements exist
|
||||
* Copyright oxmc. <https://oxmc.is-a.dev/>
|
||||
*/
|
||||
|
||||
window.addEventListener('HVJS-Load', async (event) => {
|
||||
window.addEventListener('DOMContentLoaded', async (event) => {
|
||||
console.log('DOM fully loaded and parsed, Adding player scripts and styles');
|
||||
console.log("Player-init.js, dynamicly including css and js");
|
||||
console.log("Player-init.js, dynamically including CSS and JS");
|
||||
|
||||
// Load script dynamically
|
||||
function loadScript(scriptUrl) {
|
||||
const script = document.createElement('script');
|
||||
script.src = scriptUrl;
|
||||
document.body.appendChild(script);
|
||||
|
||||
return new Promise((res, rej) => {
|
||||
script.onload = function() {
|
||||
res();
|
||||
}
|
||||
script.onerror = function() {
|
||||
rej();
|
||||
}
|
||||
script.onload = res;
|
||||
script.onerror = rej;
|
||||
});
|
||||
}
|
||||
|
||||
function removefile(filename, filetype) {
|
||||
var targetelement = (filetype == "js") ? "script" : (filetype == "css") ? "link" : "none";
|
||||
var targetattr = (filetype == "js") ? "src" : (filetype == "css") ? "href" : "none";
|
||||
var allsuspects = document.getElementsByTagName(targetelement);
|
||||
for (var i = allsuspects.length; i >= 0; i--) {
|
||||
if (allsuspects[i] && allsuspects[i].getAttribute(targetattr) != null && allsuspects[i].getAttribute(targetattr).indexOf(filename) != -1)
|
||||
allsuspects[i].parentNode.removeChild(allsuspects[i]);
|
||||
console.log(`Removed: ${filename}`);
|
||||
// Remove specified file from DOM (JS/CSS)
|
||||
function removeFile(filename, filetype) {
|
||||
const targetElement = filetype === "js" ? "script" : filetype === "css" ? "link" : null;
|
||||
const targetAttr = filetype === "js" ? "src" : filetype === "css" ? "href" : null;
|
||||
if (!targetElement || !targetAttr) return;
|
||||
|
||||
const allElements = document.getElementsByTagName(targetElement);
|
||||
for (let i = allElements.length - 1; i >= 0; i--) {
|
||||
if (allElements[i] && allElements[i].getAttribute(targetAttr)?.includes(filename)) {
|
||||
allElements[i].parentNode.removeChild(allElements[i]);
|
||||
console.log(`Removed: ${filename}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove elements by class name
|
||||
function removeElementsByClass(className) {
|
||||
const elements = document.getElementsByClassName(className);
|
||||
while (elements.length > 0) {
|
||||
@@ -41,46 +42,74 @@ window.addEventListener('HVJS-Load', async (event) => {
|
||||
}
|
||||
}
|
||||
|
||||
//List of scripts and css to load for video.js
|
||||
const include_List = {
|
||||
"css": [
|
||||
"https://vjs.zencdn.net/7.20.3/video-js.css",
|
||||
"https://hooverhigh.ml/videojs-plugins/css/videojs-bundle.min.css"
|
||||
],
|
||||
"js": [
|
||||
"https://hooverhigh.ml/videojs-plugins/ad.js",
|
||||
"https://hooverhigh.ml/videojs-plugins/hooverhigh-videojs-player.min.js"
|
||||
]
|
||||
// List of CSS and JS to load
|
||||
const includeList = {
|
||||
vjs: {
|
||||
css: [
|
||||
"bundle/vjs-player-bundle.min.css"
|
||||
],
|
||||
js: [
|
||||
"bundle/vjs-player-bundle.min.js",
|
||||
]
|
||||
},
|
||||
ajs: {
|
||||
css: [
|
||||
"assets/lib/ajs/audiojs-playertheme.css"
|
||||
],
|
||||
js: [
|
||||
"assets/lib/ajs/audio.min.js",
|
||||
"assets/lib/ajs/player.js"
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
//Add CSS:
|
||||
console.log("Adding CSS");
|
||||
include_List.css.forEach(async function(url) {
|
||||
//console.log(url);
|
||||
$("<link>", {
|
||||
rel: "stylesheet",
|
||||
type: "text/css",
|
||||
href: url
|
||||
}).appendTo("head");
|
||||
});
|
||||
// Load Video.js if there are video elements
|
||||
const videoPlayers = document.querySelectorAll("video");
|
||||
if (videoPlayers.length > 0) {
|
||||
console.log("Adding VJS CSS");
|
||||
// Add VJS CSS
|
||||
for (const url of includeList.vjs.css) {
|
||||
const link = document.createElement('link');
|
||||
link.rel = "stylesheet";
|
||||
link.type = "text/css";
|
||||
link.href = url;
|
||||
document.head.appendChild(link);
|
||||
}
|
||||
|
||||
//Add JS:
|
||||
console.log("Adding JS");
|
||||
include_List.js.forEach(async function(url) {
|
||||
//console.log(url);
|
||||
//$.getScript(url);
|
||||
$("<script>", {
|
||||
type: "application/javascript",
|
||||
src: url
|
||||
}).appendTo("body")
|
||||
});
|
||||
console.log("Adding VJS JS");
|
||||
// Load VJS JS
|
||||
try {
|
||||
await loadScript('https://vjs.zencdn.net/7.20.3/video.min.js');
|
||||
for (const url of includeList.vjs.js) {
|
||||
await loadScript(url);
|
||||
}
|
||||
// Finally, load player.js
|
||||
await loadScript('assets/lib/vjs/player.js');
|
||||
console.log('VJS Player loaded!');
|
||||
} catch (err) {
|
||||
console.error('Failed to load VJS scripts:', err);
|
||||
}
|
||||
}
|
||||
|
||||
//Run player.js:
|
||||
await loadScript('https://hooverhigh.ml/videojs-plugins/player.js').then(() => {
|
||||
console.log('Script loaded!');
|
||||
}).catch(() => {
|
||||
console.error('Script loading failed! Handle this error');
|
||||
});
|
||||
// Load Audio.js if there are audio elements
|
||||
const audioPlayers = document.querySelectorAll("audio");
|
||||
if (audioPlayers.length > 0) {
|
||||
console.log("Adding AJS CSS");
|
||||
// Add AJS CSS
|
||||
for (const url of includeList.ajs.css) {
|
||||
const link = document.createElement('link');
|
||||
link.rel = "stylesheet";
|
||||
link.type = "text/css";
|
||||
link.href = url;
|
||||
document.head.appendChild(link);
|
||||
}
|
||||
|
||||
console.log("Adding AJS JS");
|
||||
// Load AJS JS
|
||||
for (const url of includeList.ajs.js) {
|
||||
await loadScript(url);
|
||||
}
|
||||
}
|
||||
|
||||
console.log("End Player-init.js");
|
||||
});
|
||||
273
player.js
273
player.js
@@ -1,273 +0,0 @@
|
||||
/**
|
||||
* This script is the main player script designed for hooverhigh
|
||||
* HooverHighVideoPlayer 2 <https://hooverhigh.ml/>
|
||||
* Copyright oxmc. <https://oxmc.xyz/>
|
||||
*/
|
||||
|
||||
function gup(name) {
|
||||
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
|
||||
var regexS = "[\\?&]" + name + "=([^&#]*)";
|
||||
var regex = new RegExp(regexS);
|
||||
var results = regex.exec(window.location.href);
|
||||
if (results == null)
|
||||
return "";
|
||||
else
|
||||
return results[1];
|
||||
};
|
||||
|
||||
var pad = function(n, x, c) {
|
||||
return (new Array(n).join(c || '0') + x).slice(-n);
|
||||
};
|
||||
|
||||
var padRight = function(n, x, c) {
|
||||
return (x + (new Array(n).join(c || '0'))).slice(0, n);
|
||||
};
|
||||
|
||||
//This variable is never used, but is here if a user wants to include jquery automaticly if option is set:
|
||||
var jquerycodelink = "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js";
|
||||
|
||||
if (window.jQuery) {
|
||||
//jQuery is loaded:
|
||||
var jquery_version = jQuery.fn.jquery || jQuery().jquery;
|
||||
console.log("Jquery loaded, version: ", jquery_version);
|
||||
if (jquery_version < "3.3.1") {
|
||||
throw new Error("This version of jquery is not supported for this script, use jquery 3.3.1");
|
||||
};
|
||||
} else {
|
||||
throw new Error("jQuery not loaded, this script requires jquery 3.3.1");
|
||||
};
|
||||
|
||||
const defvideourl = "https://cdn.hooverhigh.ml/videos/Welcome-to-Hoover-High-School_1668535472506.mp4";
|
||||
const defvideoposter = "https://cdn.hooverhigh.ml/images/hooverhightornado.png?w=200&h=200";
|
||||
const defvideowatermark = 'https://cdn.hooverhigh.ml/images/hooverhightornado.png?w=100&h=100';
|
||||
const defvideowatermarkurl = "https://www.gusd.net/hooverhs";
|
||||
const defvideotext = "";
|
||||
const defvidtext = false;
|
||||
const defvidup = "";
|
||||
const defvideotype = "video/mp4";
|
||||
const deftechorder = ["html5"];
|
||||
const defshareurl = window.location.href || "https://hooverhigh.ml/player.html";
|
||||
const rup = false;
|
||||
|
||||
const showads = false;
|
||||
|
||||
var videoplayers = document.querySelectorAll("video");
|
||||
|
||||
if (typeof videoplayers != "undefined" && typeof videoplayers != null && typeof videoplayers == "object") {
|
||||
|
||||
for (let i = 0; i < videoplayers.length; i++) {
|
||||
let videourl, videotype, videoposter, videowatermark, videowatermarkurl, videotext, vidtext, vidup, shareurl, isdatasrc, techorder;
|
||||
|
||||
isdatasrc = false;
|
||||
|
||||
if ($(videoplayers[i]).data("vidsrc") != null && typeof $(videoplayers[i]).data("vidsrc") == "string" && $(videoplayers[i]).data("vidsrc") != "undefined") {
|
||||
isdatasrc = true;
|
||||
videourl = $(videoplayers[i]).data("vidsrc");
|
||||
} else {
|
||||
if (rup == true && gup("vid") != null && gup("vid").length != 0 && isdatasrc == false) {
|
||||
videourl = gup("vid");
|
||||
vidup = `?vid=${videourl}`;
|
||||
} else {
|
||||
videourl = defvideourl;
|
||||
vidup = defvidup;
|
||||
};
|
||||
};
|
||||
if ($(videoplayers[i]).data("srctype") != null && typeof $(videoplayers[i]).data("srctype") == "string" && $(videoplayers[i]).data("srctype") != "undefined") {
|
||||
videotype = $(videoplayers[i]).data("srctype");
|
||||
} else {
|
||||
if (rup == true && gup("vidsrctype") != null && gup("vidsrctype").length != 0) {
|
||||
videotype = gup("vidsrctype");
|
||||
} else {
|
||||
videotype = defvideotype;
|
||||
};
|
||||
};
|
||||
if ($(videoplayers[i]).data("poster") != null && typeof $(videoplayers[i]).data("poster") == "string" && $(videoplayers[i]).data("poster") != "undefined") {
|
||||
videoposter = $(videoplayers[i]).data("poster");
|
||||
} else {
|
||||
if (rup == true && gup("vidpost") != null && gup("vidpost").length != 0) {
|
||||
videoposter = gup("vidpost");
|
||||
} else {
|
||||
videoposter = defvideoposter;
|
||||
};
|
||||
};
|
||||
if ($(videoplayers[i]).data("watermark") != null && typeof $(videoplayers[i]).data("watermark") == "string" && $(videoplayers[i]).data("watermark") != "undefined") {
|
||||
videowatermark = $(videoplayers[i]).data("watermark");
|
||||
} else {
|
||||
if (rup == true && gup("vidwatermark") != null && gup("vidwatermark").length != 0) {
|
||||
videowatermark = gup("vidwatermark");
|
||||
} else {
|
||||
videowatermark = defvideowatermark;
|
||||
};
|
||||
};
|
||||
if ($(videoplayers[i]).data("watermarkurl") != null && typeof $(videoplayers[i]).data("watermarkurl") == "string" && $(videoplayers[i]).data("watermarkurl") != "undefined") {
|
||||
videowatermarkurl = $(videoplayers[i]).data("watermarkurl");
|
||||
} else {
|
||||
if (rup == true && gup("vidwatermarkurl") != null && gup("vidwatermarkurl").length != 0) {
|
||||
videowatermarkurl = gup("vidwatermarkurl");
|
||||
} else {
|
||||
videowatermarkurl = defvideowatermarkurl;
|
||||
};
|
||||
};
|
||||
if (rup == true && gup("vidtext") != null && gup("vidtext").length != 0) {
|
||||
videotext = gup("vidtext");
|
||||
vidtext = true;
|
||||
} else {
|
||||
videotext = defvideotext;
|
||||
vidtext = defvidtext;
|
||||
};
|
||||
|
||||
shareurl = `${defshareurl}${vidup}`;
|
||||
|
||||
if (videotype == "video/youtube") {
|
||||
techorder = ["youtube", "html5"];
|
||||
shareurl = videourl;
|
||||
} else {
|
||||
techorder = deftechorder;
|
||||
};
|
||||
|
||||
//console.log(videourl);
|
||||
//console.log(videotype);
|
||||
//console.log(videoposter);
|
||||
//console.log(videowatermark);
|
||||
//console.log(videowatermarkurl);
|
||||
//console.log(vidtext);
|
||||
//console.log(techorder);
|
||||
|
||||
var player = videojs(videoplayers[i], {
|
||||
plugins: {
|
||||
hotkeys: {
|
||||
volumeStep: 0.1,
|
||||
seekStep: 5,
|
||||
enableModifiersForNumbers: false
|
||||
},
|
||||
},
|
||||
textTrackSettings: vidtext,
|
||||
techOrder: techorder
|
||||
});
|
||||
|
||||
if ($(videoplayers[i]).data("vr") != null && typeof $(videoplayers[i]).data("vr") == "boolean" && $(videoplayers[i]).data("vr") != "undefined" && $(videoplayers[i]).data("vr") == true) {
|
||||
console.log("VR Init");
|
||||
player.mediainfo = player.mediainfo || {};
|
||||
player.mediainfo.projection = '360';
|
||||
// AUTO is the default and looks at mediainfo:
|
||||
player.vr({projection: 'AUTO', debug: true, forceCardboard: false});
|
||||
};
|
||||
|
||||
if (showads == true) {
|
||||
// initalize ad plugin for this player
|
||||
player.exampleAds({
|
||||
debug: true
|
||||
});
|
||||
|
||||
var Html5 = videojs.getTech('Html5');
|
||||
|
||||
var eventList = Html5.Events.concat(Html5.Events.map(function(evt) {
|
||||
return 'ad' + evt;
|
||||
})).concat(Html5.Events.map(function(evt) {
|
||||
return 'content' + evt;
|
||||
})).concat([
|
||||
// events emitted by ad plugin
|
||||
'adtimeout',
|
||||
'contentupdate',
|
||||
'contentplayback',
|
||||
'readyforpreroll',
|
||||
'readyforpostroll',
|
||||
// events emitted by third party ad implementors
|
||||
'adsready',
|
||||
'adscanceled',
|
||||
'adplaying',
|
||||
'adstart', // startLinearAdMode()
|
||||
'adend', // endLinearAdMode()
|
||||
'nopreroll',
|
||||
'nopostroll'
|
||||
|
||||
]).filter(function(evt) {
|
||||
var events = {
|
||||
progress: 1,
|
||||
timeupdate: 1,
|
||||
suspend: 1,
|
||||
emptied: 1,
|
||||
durationchange: 1,
|
||||
contentprogress: 1,
|
||||
contenttimeupdate: 1,
|
||||
contentsuspend: 1,
|
||||
contentemptied: 1,
|
||||
adprogress: 1,
|
||||
adtimeupdate: 1,
|
||||
adsuspend: 1,
|
||||
ademptied: 1,
|
||||
adabort: 1
|
||||
}
|
||||
|
||||
return !(evt in events);
|
||||
});
|
||||
|
||||
player.on(eventList, function(event) {
|
||||
var d, str, evt;
|
||||
|
||||
evt = event.type;
|
||||
|
||||
d = new Date();
|
||||
d = '' +
|
||||
pad(2, d.getHours()) + ':' +
|
||||
pad(2, d.getMinutes()) + ':' +
|
||||
pad(2, d.getSeconds()) + '.' +
|
||||
pad(3, d.getMilliseconds());
|
||||
});
|
||||
};
|
||||
|
||||
var shareOptions = {
|
||||
socials: ['fb', 'tw', 'reddit', 'telegram', 'whatsapp'],
|
||||
url: shareurl,
|
||||
title: 'HooverHigh Video',
|
||||
description: 'video.js share plugin',
|
||||
image: 'https://hooverhigh.ml/assets/img/HooverHS.png',
|
||||
// required for Facebook and Messenger
|
||||
fbAppId: '436772158593997',
|
||||
redirectUri: `${shareurl}#close`,
|
||||
embedCode: `<iframe src='${shareurl}' width='560' height='315' frameborder='0' allowfullscreen></iframe>`
|
||||
}
|
||||
|
||||
//Init plugins:
|
||||
player.errors();
|
||||
player.errors.extend({
|
||||
"web-vr-hls-cors-not-supported": {
|
||||
headline: 'HLS 360 Error',
|
||||
message: 'Your browser/device does not support HLS 360 video. See http://webvr.info for assistance.'
|
||||
}
|
||||
});
|
||||
//player.replayButton();
|
||||
player.share(shareOptions);
|
||||
|
||||
//Set player src and poster:
|
||||
player.poster(videoposter);
|
||||
player.src({
|
||||
src: videourl,
|
||||
type: videotype,
|
||||
});
|
||||
|
||||
//Set player watermark:
|
||||
player.watermark({
|
||||
fadeTime: null,
|
||||
position: 'top-right',
|
||||
image: videowatermark,
|
||||
url: videowatermarkurl
|
||||
});
|
||||
|
||||
//Captions:
|
||||
if (vidtext != null && vidtext == true) {
|
||||
const trackEl = player.addRemoteTextTrack({
|
||||
src: videotext
|
||||
}, false);
|
||||
// Get all text tracks for the current player.
|
||||
/*var tracks = player.textTracks();
|
||||
for (var i = 0; i < tracks.length; i++) {
|
||||
var track = tracks[i];*/
|
||||
// Find the English captions track and mark it as "showing".
|
||||
/*if (track.kind === 'captions' && track.language === 'en') {
|
||||
track.mode = 'showing';
|
||||
}
|
||||
}*/
|
||||
};
|
||||
};
|
||||
};
|
||||
272
src/module/share/share.css
Normal file
272
src/module/share/share.css
Normal file
@@ -0,0 +1,272 @@
|
||||
/**
|
||||
* videojs-share
|
||||
* @version 3.2.1
|
||||
* @copyright 2019 Mikhail Khazov <mkhazov.work@gmail.com>
|
||||
* @license MIT
|
||||
*/
|
||||
.video-js.vjs-videojs-share_open .vjs-modal-dialog {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.video-js.vjs-videojs-share_open .vjs-modal-dialog .vjs-modal-dialog-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0;
|
||||
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.77), rgba(0, 0, 0, 0.75));
|
||||
}
|
||||
|
||||
.video-js.vjs-videojs-share_open .vjs-modal-dialog .vjs-close-button {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 0;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
opacity: 0.9;
|
||||
transition: opacity 0.25s ease-out;
|
||||
}
|
||||
|
||||
.video-js.vjs-videojs-share_open .vjs-modal-dialog .vjs-close-button:before {
|
||||
content: '×';
|
||||
font-size: 20px;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.video-js.vjs-videojs-share_open .vjs-modal-dialog .vjs-close-button:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.video-js .vjs-share {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
max-height: 400px;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__top,
|
||||
.video-js .vjs-share__middle,
|
||||
.video-js .vjs-share__bottom {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__top,
|
||||
.video-js .vjs-share__middle {
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__middle {
|
||||
padding: 0 25px;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__title {
|
||||
align-self: center;
|
||||
font-size: 22px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__subtitle {
|
||||
width: 100%;
|
||||
margin: 0 auto 12px;
|
||||
font-size: 16px;
|
||||
color: #fff;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__short-link-wrapper {
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
margin: 0 auto 15px;
|
||||
border: 0;
|
||||
background-color: #363636;
|
||||
color: rgba(255, 255, 255, 0.65);
|
||||
outline: none;
|
||||
overflow: hidden;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__short-link {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0 40px 0 15px;
|
||||
border: 0;
|
||||
background-color: #363636;
|
||||
color: rgba(255, 255, 255, 0.65);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__btn {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
height: 40px;
|
||||
width: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 11px;
|
||||
border: 0;
|
||||
color: #fff;
|
||||
background-color: #2e2e2e;
|
||||
background-size: 18px 19px;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
transition: width 0.3s ease-out, padding 0.3s ease-out;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__btn svg {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__btn span {
|
||||
position: relative;
|
||||
padding-left: 10px;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease-out;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__btn:hover {
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
padding: 0 40px;
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__btn:hover span {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__socials {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
align-content: flex-start;
|
||||
transition: width 0.3s ease-out, height 0.3s ease-out;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__social {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
margin-right: 6px;
|
||||
margin-bottom: 6px;
|
||||
cursor: pointer;
|
||||
font-size: 8px;
|
||||
transition: transform 0.3s ease-out, filter 0.2s ease-out;
|
||||
border: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__social:hover {
|
||||
filter: brightness(115%);
|
||||
}
|
||||
|
||||
.video-js .vjs-share__social svg {
|
||||
overflow: visible;
|
||||
max-height: 24px;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__social_vk {
|
||||
background-color: #5d7294;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__social_ok {
|
||||
background-color: #ed7c20;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__social_mail,
|
||||
.video-js .vjs-share__social_email {
|
||||
background-color: #134785;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__social_tw {
|
||||
background-color: #76aaeb;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__social_reddit {
|
||||
background-color: #ff4500;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__social_fbFeed {
|
||||
background-color: #475995;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__social_messenger {
|
||||
background-color: #0084ff;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__social_gp {
|
||||
background-color: #d53f35;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__social_linkedin {
|
||||
background-color: #0077b5;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__social_viber {
|
||||
background-color: #766db5;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__social_telegram {
|
||||
background-color: #4bb0e2;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__social_whatsapp {
|
||||
background-color: #78c870;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__bottom {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
@media (max-height: 220px) {
|
||||
.video-js .vjs-share .hidden-xs {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-height: 350px) {
|
||||
.video-js .vjs-share .hidden-sm {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-height: 400px) {
|
||||
.video-js .vjs-share__title {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__short-link-wrapper {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 320px) {
|
||||
.video-js.vjs-videojs-share_open .vjs-modal-dialog .vjs-close-button {
|
||||
right: 5px;
|
||||
top: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 660px) {
|
||||
.video-js.vjs-videojs-share_open .vjs-modal-dialog .vjs-close-button {
|
||||
right: 20px;
|
||||
top: 20px;
|
||||
}
|
||||
|
||||
.video-js .vjs-share__social {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
1665
src/module/share/share.js
Normal file
1665
src/module/share/share.js
Normal file
File diff suppressed because it is too large
Load Diff
37
src/module/watermark/watermark.css
Normal file
37
src/module/watermark/watermark.css
Normal file
@@ -0,0 +1,37 @@
|
||||
.vjs-watermark {
|
||||
position: absolute;
|
||||
display: inline-block; /* Changed to inline-block to handle better positioning */
|
||||
z-index: 2000;
|
||||
pointer-events: none; /* Prevents watermark from blocking interactions with the player */
|
||||
}
|
||||
|
||||
/* For center positioning with relative units */
|
||||
.vjs-watermark.center {
|
||||
transform: translate(-50%, -50%);
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
}
|
||||
|
||||
/* Bottom-right corner */
|
||||
.vjs-watermark.bottom-right {
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
/* Bottom-left corner */
|
||||
.vjs-watermark.bottom-left {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
/* Top-right corner */
|
||||
.vjs-watermark.top-right {
|
||||
top: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
/* Top-left corner */
|
||||
.vjs-watermark.top-left {
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
110
src/module/watermark/watermark.js
Normal file
110
src/module/watermark/watermark.js
Normal file
@@ -0,0 +1,110 @@
|
||||
console.log('watermark: Start');
|
||||
|
||||
(function () {
|
||||
console.log('watermark: Init defaults');
|
||||
var defaults = {
|
||||
file: 'Owned_Stamp.png',
|
||||
xpos: 0,
|
||||
ypos: 0,
|
||||
xrepeat: 0,
|
||||
opacity: 100,
|
||||
clickable: false,
|
||||
url: "",
|
||||
className: 'vjs-watermark',
|
||||
text: false,
|
||||
debug: false
|
||||
},
|
||||
extend = function () {
|
||||
var args, target, i, object, property;
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
target = args.shift() || {};
|
||||
for (i in args) {
|
||||
object = args[i];
|
||||
for (property in object) {
|
||||
if (object.hasOwnProperty(property)) {
|
||||
if (typeof object[property] === 'object') {
|
||||
target[property] = extend(target[property], object[property]);
|
||||
} else {
|
||||
target[property] = object[property];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
};
|
||||
|
||||
//! global varible containing reference to the DOM element
|
||||
var div;
|
||||
|
||||
/**
|
||||
* register the watermark plugin using registerPlugin
|
||||
*/
|
||||
videojs.registerPlugin('watermark', function (settings) {
|
||||
if (settings.debug) console.log('watermark: Register init');
|
||||
|
||||
var options, player, video, img, link;
|
||||
options = extend(defaults, settings);
|
||||
|
||||
/* Grab the necessary DOM elements */
|
||||
player = this.el();
|
||||
video = this.el().getElementsByTagName('video')[0];
|
||||
|
||||
// create the watermark element
|
||||
if (!div) {
|
||||
div = document.createElement('div');
|
||||
div.className = options.className;
|
||||
}
|
||||
else {
|
||||
//! if div already exists, empty it
|
||||
div.innerHTML = '';
|
||||
}
|
||||
|
||||
// if text is set, display text
|
||||
if (options.text)
|
||||
div.textContent = options.text;
|
||||
|
||||
// if img is set, add img
|
||||
if (options.file) {
|
||||
img = document.createElement('img');
|
||||
div.appendChild(img);
|
||||
img.src = options.file;
|
||||
}
|
||||
|
||||
// Positioning the watermark
|
||||
if ((options.ypos === 0) && (options.xpos === 0)) { // Top left
|
||||
div.style.top = "0";
|
||||
div.style.left = "0";
|
||||
} else if ((options.ypos === 0) && (options.xpos === 100)) { // Top right
|
||||
div.style.top = "0";
|
||||
div.style.right = "0";
|
||||
} else if ((options.ypos === 100) && (options.xpos === 100)) { // Bottom right
|
||||
div.style.bottom = "0";
|
||||
div.style.right = "0";
|
||||
} else if ((options.ypos === 100) && (options.xpos === 0)) { // Bottom left
|
||||
div.style.bottom = "0";
|
||||
div.style.left = "0";
|
||||
} else if ((options.ypos === 50) && (options.xpos === 50)) { // Center
|
||||
if (options.debug) console.log('watermark: player:' + player.width + 'x' + player.height);
|
||||
if (options.debug) console.log('watermark: video:' + video.videoWidth + 'x' + video.videoHeight);
|
||||
if (options.debug) console.log('watermark: image:' + img.width + 'x' + img.height);
|
||||
div.style.top = (this.height() / 2) + "px";
|
||||
div.style.left = (this.width() / 2) + "px";
|
||||
}
|
||||
div.style.opacity = options.opacity;
|
||||
|
||||
// if user wants watermark to be clickable, add anchor element
|
||||
if (options.clickable && options.url !== "") {
|
||||
link = document.createElement("a");
|
||||
link.href = options.url;
|
||||
link.target = "_blank";
|
||||
link.appendChild(div);
|
||||
// add clickable watermark to the player
|
||||
player.appendChild(link);
|
||||
} else {
|
||||
// add normal watermark to the player
|
||||
player.appendChild(div);
|
||||
}
|
||||
|
||||
if (options.debug) console.log('watermark: Register end');
|
||||
});
|
||||
})();
|
||||
263
src/player.js
Normal file
263
src/player.js
Normal file
@@ -0,0 +1,263 @@
|
||||
/**
|
||||
* Main player script
|
||||
* Copyright oxmc. <https://oxmc.me/>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
// Utility functions
|
||||
const gup = (name) => {
|
||||
const regex = new RegExp(`[?&]${name.replace(/[\[\]]/g, "\\$&")}=([^&#]*)`);
|
||||
const results = regex.exec(window.location.href);
|
||||
return results ? decodeURIComponent(results[1].replace(/\+/g, " ")) : "";
|
||||
};
|
||||
|
||||
const pad = (n, x, c = '0') => (c.repeat(n) + x).slice(-n);
|
||||
const padRight = (n, x, c = '0') => (x + c.repeat(n)).slice(0, n);
|
||||
|
||||
// jQuery check
|
||||
const jqueryCodeLink = "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js";
|
||||
|
||||
if (typeof jQuery === "undefined") {
|
||||
throw new Error("jQuery not loaded. This script requires jQuery 3.3.1.");
|
||||
}
|
||||
|
||||
const jqueryVersion = jQuery.fn.jquery;
|
||||
console.log(`jQuery loaded, version: ${jqueryVersion}`);
|
||||
|
||||
if (jqueryVersion < "3.3.1") {
|
||||
throw new Error("Unsupported jQuery version. Please use jQuery 3.3.1 or newer.");
|
||||
}
|
||||
|
||||
// Default video settings
|
||||
const defaults = {
|
||||
videoUrl: "/uploads/oxmc/videos/spinning_protogen.mp4",
|
||||
videoPoster: "/images/internal/oxie-servers.png?w=200&h=200",
|
||||
videoWatermark: "/images/internal/oxie-servers.png?w=50&h=50",
|
||||
videoWatermarkUrl: "/",
|
||||
videoText: "",
|
||||
showTextOverlay: false,
|
||||
videoType: "video/mp4",
|
||||
techOrder: ["html5"],
|
||||
shareUrl: `${window.location.origin}/player`,
|
||||
shareOptions: {
|
||||
socials: ['fbFeed', 'tw', 'reddit', 'telegram', 'whatsapp', 'messenger'],
|
||||
title: 'oxmc cdn, media player',
|
||||
description: 'I want to share this with you!',
|
||||
image: 'https://cdn.oxmc-servers.online/uploads/images/happy_ox.jpeg',
|
||||
fbAppId: '7558484347561334',
|
||||
redirectUri: `${window.location.origin}/player#close`,
|
||||
embedCode: `<iframe src='${window.location.origin}/player' width='560' height='315' frameborder='0' allowfullscreen></iframe>`,
|
||||
},
|
||||
};
|
||||
|
||||
const options = {
|
||||
enableUrlOverrides: true,
|
||||
enableWatermarkOverrides: false,
|
||||
showAds: false,
|
||||
};
|
||||
|
||||
// Setup players
|
||||
const videoPlayers = document.querySelectorAll("video");
|
||||
|
||||
if (videoPlayers.length > 0) {
|
||||
videoPlayers.forEach((video) => {
|
||||
let videoUrl = defaults.videoUrl;
|
||||
let videoType = defaults.videoType;
|
||||
let videoPoster = defaults.videoPoster;
|
||||
let videoWatermark = defaults.videoWatermark;
|
||||
let videoWatermarkUrl = defaults.videoWatermarkUrl;
|
||||
let videoText = defaults.videoText;
|
||||
let showTextOverlay = defaults.showTextOverlay;
|
||||
let techOrder = [...defaults.techOrder];
|
||||
let shareUrl = defaults.shareUrl;
|
||||
let vidId = null;
|
||||
|
||||
const $video = $(video);
|
||||
|
||||
// Pull per-video overrides from data- attributes
|
||||
const dataUrl = video.getAttribute("data-url");
|
||||
if (dataUrl) videoUrl = dataUrl;
|
||||
|
||||
const dataType = video.getAttribute("data-type");
|
||||
if (dataType) videoType = dataType;
|
||||
|
||||
const dataPoster = video.getAttribute("data-poster");
|
||||
if (dataPoster) videoPoster = dataPoster;
|
||||
|
||||
const dataWatermark = video.getAttribute("data-watermark");
|
||||
if (dataWatermark) videoWatermark = dataWatermark;
|
||||
|
||||
const dataWatermarkUrl = video.getAttribute("data-watermarkurl");
|
||||
if (dataWatermarkUrl) videoWatermarkUrl = dataWatermarkUrl;
|
||||
|
||||
const dataText = video.getAttribute("data-text");
|
||||
if (dataText) videoText = dataText;
|
||||
|
||||
const dataShowTextOverlay = video.getAttribute("data-showtextoverlay");
|
||||
if (dataShowTextOverlay !== null) showTextOverlay = dataShowTextOverlay === "true";
|
||||
|
||||
const dataTechOrder = video.getAttribute("data-techorder");
|
||||
if (dataTechOrder) techOrder = dataTechOrder.split(",");
|
||||
|
||||
const dataShareUrl = video.getAttribute("data-shareurl");
|
||||
if (dataShareUrl) shareUrl = dataShareUrl;
|
||||
|
||||
const dataId = video.getAttribute("data-id");
|
||||
if (dataId) vidId = dataId;
|
||||
|
||||
// Pull custom share options from data- attributes
|
||||
const customShareOptions = {
|
||||
title: video.getAttribute("data-sharetitle") || defaults.shareOptions.title,
|
||||
description: video.getAttribute("data-sharedescription") || defaults.shareOptions.description,
|
||||
image: video.getAttribute("data-shareimage") || videoPoster || defaults.shareOptions.image,
|
||||
};
|
||||
|
||||
// Get video URL
|
||||
if (options.enableUrlOverrides && gup("vid")) {
|
||||
videoUrl = gup("vid");
|
||||
} else if (typeof $video.data("vidsrc") === "string") {
|
||||
videoUrl = $video.data("vidsrc");
|
||||
}
|
||||
|
||||
const vidParam = `?vid=${encodeURIComponent(videoUrl)}`;
|
||||
|
||||
// Determine video type
|
||||
if (options.enableUrlOverrides && gup("vidsrctype")) {
|
||||
videoType = gup("vidsrctype");
|
||||
} else if (typeof $video.data("srctype") === "string") {
|
||||
videoType = $video.data("srctype");
|
||||
} else {
|
||||
const youtubeMatch = videoUrl.match(/(?:youtube\.com\/.*v=|youtu\.be\/)([a-zA-Z0-9_-]{11})/);
|
||||
if (youtubeMatch) {
|
||||
videoType = "video/youtube";
|
||||
vidId = youtubeMatch[1];
|
||||
}
|
||||
}
|
||||
|
||||
// Update techOrder for YouTube
|
||||
if (videoType === "video/youtube") {
|
||||
techOrder = ["youtube", "html5"];
|
||||
shareUrl = videoUrl;
|
||||
}
|
||||
|
||||
// Set poster image
|
||||
if (options.enableUrlOverrides && gup("vidpost")) {
|
||||
videoPoster = gup("vidpost") === 'none' ? null : gup("vidpost");
|
||||
} else if (typeof $video.data("poster") === "string") {
|
||||
videoPoster = $video.data("poster");
|
||||
} else if (vidId) {
|
||||
videoPoster = `https://i.ytimg.com/vi/${vidId}/hqdefault.jpg`;
|
||||
}
|
||||
|
||||
// Set watermark and URL
|
||||
videoWatermark = options.enableWatermarkOverrides && gup("vidwatermark")
|
||||
? gup("vidwatermark")
|
||||
: ($video.data("watermark") || defaults.videoWatermark);
|
||||
|
||||
videoWatermarkUrl = options.enableWatermarkOverrides && gup("vidwatermarkurl")
|
||||
? gup("vidwatermarkurl")
|
||||
: ($video.data("watermarkurl") || defaults.videoWatermarkUrl);
|
||||
|
||||
// Set text overlay
|
||||
if (options.enableWatermarkOverrides && gup("vidtext")) {
|
||||
videoText = gup("vidtext");
|
||||
showTextOverlay = true;
|
||||
}
|
||||
|
||||
// Set final share URL
|
||||
if (videoType !== "video/youtube") {
|
||||
shareUrl = `${defaults.shareUrl}${vidParam}`;
|
||||
}
|
||||
|
||||
// Initialize video.js
|
||||
const player = videojs(video, {
|
||||
plugins: {
|
||||
hotkeys: {
|
||||
volumeStep: 0.1,
|
||||
seekStep: 5,
|
||||
enableModifiersForNumbers: false,
|
||||
},
|
||||
videoJsResolutionSwitcher: {
|
||||
default: 'hd1080',
|
||||
dynamicLabel: true,
|
||||
},
|
||||
},
|
||||
textTrackSettings: showTextOverlay,
|
||||
techOrder,
|
||||
});
|
||||
|
||||
// Initialize VR if applicable
|
||||
if ($video.data("vr") === true) {
|
||||
console.log("Initializing VR mode");
|
||||
player.mediainfo = player.mediainfo || {};
|
||||
player.mediainfo.projection = '360';
|
||||
player.vr({ projection: 'AUTO', debug: true, forceCardboard: false });
|
||||
}
|
||||
|
||||
// Initialize ads if enabled
|
||||
if (options.showAds) {
|
||||
player.exampleAds({ debug: true });
|
||||
|
||||
const Html5 = videojs.getTech('Html5');
|
||||
const eventsToWatch = [...new Set([
|
||||
...Html5.Events,
|
||||
...Html5.Events.map(e => 'ad' + e),
|
||||
...Html5.Events.map(e => 'content' + e),
|
||||
'adtimeout', 'contentupdate', 'contentplayback', 'readyforpreroll', 'readyforpostroll',
|
||||
'adsready', 'adscanceled', 'adplaying', 'adstart', 'adend', 'nopreroll', 'nopostroll'
|
||||
])].filter(e => ![
|
||||
'progress', 'timeupdate', 'suspend', 'emptied', 'durationchange',
|
||||
'contentprogress', 'contenttimeupdate', 'contentsuspend', 'contentemptied',
|
||||
'adprogress', 'adtimeupdate', 'adsuspend', 'ademptied', 'adabort'
|
||||
].includes(e));
|
||||
|
||||
player.on(eventsToWatch, (event) => {
|
||||
console.log(`Player event: ${event.type}`);
|
||||
});
|
||||
}
|
||||
|
||||
// Share options
|
||||
const shareOptions = {
|
||||
...defaults.shareOptions,
|
||||
url: shareUrl,
|
||||
redirectUri: `${window.location.origin}/player#close`,
|
||||
embedCode: `<iframe src='${shareUrl}' width='560' height='315' frameborder='0' allowfullscreen></iframe>`,
|
||||
};
|
||||
|
||||
// Init plugins
|
||||
player.errors();
|
||||
player.errors.extend({
|
||||
"web-vr-hls-cors-not-supported": {
|
||||
headline: 'HLS 360 Error',
|
||||
message: 'Your browser/device does not support HLS 360 video. See http://webvr.info for assistance.',
|
||||
}
|
||||
});
|
||||
|
||||
player.share(shareOptions);
|
||||
|
||||
// Set player src and poster
|
||||
player.poster(videoPoster);
|
||||
player.src({
|
||||
src: videoUrl,
|
||||
type: videoType,
|
||||
});
|
||||
|
||||
// Set player watermark
|
||||
player.watermark({
|
||||
fadeTime: null,
|
||||
position: 'top-right',
|
||||
image: videoWatermark,
|
||||
url: videoWatermarkUrl,
|
||||
});
|
||||
|
||||
// Captions
|
||||
if (videoText) {
|
||||
player.addRemoteTextTrack({
|
||||
src: videoText,
|
||||
}, false);
|
||||
};
|
||||
});
|
||||
} else {
|
||||
console.log("No video players found on the page.");
|
||||
};
|
||||
121
src/theme.scss
Normal file
121
src/theme.scss
Normal file
@@ -0,0 +1,121 @@
|
||||
/* The following are SCSS variables to automate some of the values.
|
||||
But don't feel limited by them. Change/replace whatever you want. */
|
||||
|
||||
// The color of icons, text, and the big play button border.
|
||||
// Try changing to #0f0
|
||||
$primary-foreground-color: #CF9FFF; // #fff default
|
||||
|
||||
// The default color of control backgrounds is mostly black but with a little
|
||||
// bit of blue so it can still be seen on all-black video frames, which are common.
|
||||
// Try changing to #900
|
||||
$primary-background-color: #7a9dc1b3; // #2B333F default
|
||||
|
||||
// Try changing to true
|
||||
$center-big-play-button: true; // true default
|
||||
|
||||
.video-js {
|
||||
/* The base font size controls the size of everything, not just text.
|
||||
All dimensions use em-based sizes so that the scale along with the font size.
|
||||
Try increasing it to 15px and see what happens. */
|
||||
font-size: 10px;
|
||||
|
||||
/* The main font color changes the ICON COLORS as well as the text */
|
||||
color: $primary-foreground-color;
|
||||
}
|
||||
|
||||
/* The "Big Play Button" is the play button that shows before the video plays.
|
||||
To center it set the align values to center and middle. The typical location
|
||||
of the button is the center, but there is a trend towards moving it to a corner
|
||||
where it gets out of the way of valuable content in the poster image.*/
|
||||
.vjs-default-skin .vjs-big-play-button {
|
||||
/* The font size is what makes the big play button...big.
|
||||
All width/height values use ems, which are a multiple of the font size.
|
||||
If the .video-js font-size is 10px, then 3em equals 30px.*/
|
||||
font-size: 3em;
|
||||
|
||||
/* We're using SCSS vars here because the values are used in multiple places.
|
||||
Now that font size is set, the following em values will be a multiple of the
|
||||
new font size. If the font-size is 3em (30px), then setting any of
|
||||
the following values to 3em would equal 30px. 3 * font-size. */
|
||||
$big-play-width: 3em;
|
||||
/* 1.5em = 45px default */
|
||||
$big-play-height: 1.5em;
|
||||
|
||||
line-height: $big-play-height;
|
||||
height: $big-play-height;
|
||||
width: $big-play-width;
|
||||
|
||||
/* 0.06666em = 2px default */
|
||||
border: 0.06666em solid $primary-foreground-color;
|
||||
/* 0.3em = 9px default */
|
||||
border-radius: 0.3em;
|
||||
|
||||
@if $center-big-play-button {
|
||||
/* Align center */
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
margin-left: -($big-play-width / 2);
|
||||
margin-top: -($big-play-height / 2);
|
||||
} @else {
|
||||
/* Align top left. 0.5em = 15px default */
|
||||
left: 0.5em;
|
||||
top: 0.5em;
|
||||
}
|
||||
}
|
||||
|
||||
/* The default color of control backgrounds is mostly black but with a little
|
||||
bit of blue so it can still be seen on all-black video frames, which are common. */
|
||||
.video-js .vjs-control-bar,
|
||||
.video-js .vjs-big-play-button,
|
||||
.video-js .vjs-menu-button .vjs-menu-content {
|
||||
/* IE8 - has no alpha support */
|
||||
background-color: $primary-background-color;
|
||||
/* Opacity: 1.0 = 100%, 0.0 = 0% */
|
||||
background-color: rgba($primary-background-color, 0.7);
|
||||
}
|
||||
|
||||
// Make a slightly lighter version of the main background
|
||||
// for the slider background.
|
||||
$slider-bg-color: lighten($primary-background-color, 33%);
|
||||
|
||||
/* Slider - used for Volume bar and Progress bar */
|
||||
.video-js .vjs-slider {
|
||||
background-color: $slider-bg-color;
|
||||
background-color: rgba($slider-bg-color, 0.5);
|
||||
}
|
||||
|
||||
/* The slider bar color is used for the progress bar and the volume bar
|
||||
(the first two can be removed after a fix that's coming) */
|
||||
.video-js .vjs-volume-level,
|
||||
.video-js .vjs-play-progress,
|
||||
.video-js .vjs-slider-bar {
|
||||
background: $primary-foreground-color;
|
||||
}
|
||||
|
||||
/* The main progress bar also has a bar that shows how much has been loaded. */
|
||||
.video-js .vjs-load-progress {
|
||||
/* For IE8 we'll lighten the color */
|
||||
background: lighten($slider-bg-color, 25%);
|
||||
/* Otherwise we'll rely on stacked opacities */
|
||||
background: rgba($slider-bg-color, 0.5);
|
||||
}
|
||||
|
||||
/* The load progress bar also has internal divs that represent
|
||||
smaller disconnected loaded time ranges */
|
||||
.video-js .vjs-load-progress div {
|
||||
/* For IE8 we'll lighten the color */
|
||||
background: lighten($slider-bg-color, 50%);
|
||||
/* Otherwise we'll rely on stacked opacities */
|
||||
background: rgba($slider-bg-color, 0.75);
|
||||
}
|
||||
|
||||
/* Hover effect for the Big Play Button */
|
||||
.video-js:hover .vjs-big-play-button {
|
||||
border-color: $primary-foreground-color;
|
||||
background-color: rgba(117, 168, 242, 0.5) !important; /* Semi-transparent background */
|
||||
}
|
||||
|
||||
/* Hover effect for Control Bar (volume, progress, etc.) */
|
||||
/*.video-js:hover .vjs-control-bar .vjs-control {
|
||||
background-color: rgba(115, 133, 159, 0.5);
|
||||
}*/
|
||||
Reference in New Issue
Block a user