init
commit
2a3b3fd495
@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
@ -0,0 +1,9 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact name="chrome">
|
||||
<output-path>$PROJECT_DIR$/out/artifacts/chrome</output-path>
|
||||
<root id="root">
|
||||
<element id="dir-copy" path="$PROJECT_DIR$/base" />
|
||||
<element id="dir-copy" path="$PROJECT_DIR$/chrome" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
@ -0,0 +1,9 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact name="firefox">
|
||||
<output-path>$PROJECT_DIR$/out/artifacts/firefox</output-path>
|
||||
<root id="root">
|
||||
<element id="dir-copy" path="$PROJECT_DIR$/base" />
|
||||
<element id="dir-copy" path="$PROJECT_DIR$/firefox" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/base/base.iml" filepath="$PROJECT_DIR$/base/base.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/chrome/chrome.iml" filepath="$PROJECT_DIR$/chrome/chrome.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/firefox/firefox.iml" filepath="$PROJECT_DIR$/firefox/firefox.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/stammtv-browserext.iml" filepath="$PROJECT_DIR$/stammtv-browserext.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,5 @@
|
||||
## Build
|
||||
|
||||
|
||||
## Prerequisites
|
||||
- Chromium based Browser (Chrome, Edge, ..)
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="GENERAL_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/.." />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Options for StammTV Chrome Extension</title>
|
||||
</head>
|
||||
<body>
|
||||
<div style="display: grid;">
|
||||
<label>
|
||||
StammTV Base URL: <input type="url" id="stammtv-base-url" style="min-width: 20rem;">
|
||||
</label>
|
||||
<label>
|
||||
StammTV WSS URL: <input type="url" id="stammtv-wss-url" style="min-width: 20rem;">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div id="status" style="color: #259025"></div>
|
||||
<button id="save">Save</button>
|
||||
|
||||
<script src="options.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,32 @@
|
||||
// Saves options to chrome.storage
|
||||
function save_options() {
|
||||
var stammTVBaseUrl = document.getElementById('stammtv-base-url').value;;
|
||||
var stammTVWSSUrl = document.getElementById('stammtv-wss-url').value;;
|
||||
chrome.storage.local.set({
|
||||
baseURL: stammTVBaseUrl,
|
||||
wssURL: stammTVWSSUrl
|
||||
}, function () {
|
||||
// Update status to let user know options were saved.
|
||||
var status = document.getElementById('status');
|
||||
status.textContent = 'Saved.';
|
||||
status.style.color = '00FF00';
|
||||
setTimeout(function () {
|
||||
status.textContent = '';
|
||||
}, 1500);
|
||||
});
|
||||
}
|
||||
|
||||
// Restores select box and checkbox state using the preferences
|
||||
// stored in chrome.storage.
|
||||
function restore_options() {
|
||||
chrome.storage.local.get({
|
||||
baseURL: 'Please fill in.',
|
||||
wssURL: 'Please fill in.'
|
||||
}, function (items) {
|
||||
document.getElementById('stammtv-base-url').value = items.baseURL;
|
||||
document.getElementById('stammtv-wss-url').value = items.wssURL;
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', restore_options);
|
||||
document.getElementById('save').addEventListener('click', save_options);
|
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Popup</title>
|
||||
</head>
|
||||
<body style="min-width: 10rem; min-height: 5rem; display: flex; justify-content: center; align-items: center;">
|
||||
<a href="" id="open-stammtv" target="_blank" style="font-weight: bold; color: #ff0000; border: 1px solid black">→ Take me to StammTV!</a>
|
||||
<script src="popup.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,7 @@
|
||||
function restore_options() {
|
||||
chrome.storage.local.get('baseURL', function (result) {
|
||||
document.getElementById('open-stammtv').href = result.baseURL;
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', restore_options);
|
@ -0,0 +1,72 @@
|
||||
chrome.storage.local.get('firstRun', function (result) {
|
||||
if (result.firstRun === false) {
|
||||
firstRun();
|
||||
}
|
||||
});
|
||||
|
||||
function firstRun(){
|
||||
chrome.storage.local.set({'firstRun': false}, function (result) {
|
||||
chrome.tabs.create
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
const CONTEXT_MENU_ID = "STAMMTV_ADD_URL_TO_PLAYLIST";
|
||||
const YOUTUBE_URL_REGEX = /^(?:https?:\/\/(?:www\.)?youtu(?:\.be\/|be\.com\/watch\?v=|be\.com\/shorts\/)){1}([^#&?]*)(?:[?&]t=\d+)?.*/;
|
||||
|
||||
let WEBSOCKET_URL = "";
|
||||
let websocket;
|
||||
|
||||
|
||||
chrome.storage.local.get('wssURL', function (result) {
|
||||
WEBSOCKET_URL = result.wssURL;
|
||||
});
|
||||
|
||||
chrome.contextMenus.create({
|
||||
title: "Zu StammTV Playlist hinzufügen...",
|
||||
contexts: ["link"],
|
||||
id: CONTEXT_MENU_ID
|
||||
});
|
||||
|
||||
chrome.contextMenus.onClicked.addListener(addToStammTV);
|
||||
|
||||
function parseYoutubeURL(url) {
|
||||
let match = url.match(YOUTUBE_URL_REGEX);
|
||||
return (match && match[1].length === 11) ? match[1] : false;
|
||||
}
|
||||
|
||||
function addToStammTV(info, tab) {
|
||||
if (info.menuItemId === CONTEXT_MENU_ID) { //if OUR menu item was clicked
|
||||
let videoId = parseYoutubeURL(info.linkUrl)
|
||||
if (videoId) {
|
||||
const playerReady = {"type":"playerReady"};
|
||||
|
||||
const setVideo = {
|
||||
type: "setVideo",
|
||||
video: videoId,
|
||||
};
|
||||
|
||||
console.log(websocket);
|
||||
if (websocket === undefined
|
||||
|| websocket.readyState !== WebSocket.OPEN) {
|
||||
websocket = new WebSocket(WEBSOCKET_URL);
|
||||
console.log('websocket created');
|
||||
}
|
||||
|
||||
websocket.onopen = function () {
|
||||
console.log('websocket ready');
|
||||
websocket.send(JSON.stringify(playerReady));
|
||||
websocket.send(JSON.stringify(setVideo));
|
||||
console.log(setVideo);
|
||||
};
|
||||
|
||||
setTimeout(function () {
|
||||
websocket.close();
|
||||
console.log('websocket closed');
|
||||
}, 1000);
|
||||
|
||||
} else {
|
||||
console.error('o(一︿一+)o not a valid videoId');
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="GENERAL_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/.." />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "StammTV Chrome Extension",
|
||||
"description": "Adds a context-menu option to send URLs to StammTV",
|
||||
"version": "1.0",
|
||||
"manifest_version": 3,
|
||||
"background": {
|
||||
"service_worker": "script.js"
|
||||
},
|
||||
"options_page": "options/options.html",
|
||||
"permissions": [
|
||||
"storage",
|
||||
"contextMenus"
|
||||
],
|
||||
"action": {
|
||||
"default_popup": "popup/popup.html"
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="GENERAL_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/.." />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "StammTV Firefox Extension",
|
||||
"description": "Adds a context-menu option to send URLs to StammTV",
|
||||
"version": "1.0",
|
||||
"manifest_version": 2,
|
||||
"background": {
|
||||
"scripts": ["script.js"]
|
||||
},
|
||||
"options_page": "options/options.html",
|
||||
"permissions": [
|
||||
"storage",
|
||||
"contextMenus"
|
||||
],
|
||||
"action": {
|
||||
"default_popup": "popup/popup.html"
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="GENERAL_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/.." />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="GENERAL_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/.." />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "StammTV Chrome Extension",
|
||||
"description": "Adds a context-menu option to send URLs to StammTV",
|
||||
"version": "1.0",
|
||||
"manifest_version": 3,
|
||||
"background": {
|
||||
"service_worker": "script.js"
|
||||
},
|
||||
"options_page": "options/options.html",
|
||||
"permissions": [
|
||||
"storage",
|
||||
"contextMenus"
|
||||
],
|
||||
"action": {
|
||||
"default_popup": "popup/popup.html"
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Options for StammTV Chrome Extension</title>
|
||||
</head>
|
||||
<body>
|
||||
<div style="display: grid;">
|
||||
<label>
|
||||
StammTV Base URL: <input type="url" id="stammtv-base-url" style="min-width: 20rem;">
|
||||
</label>
|
||||
<label>
|
||||
StammTV WSS URL: <input type="url" id="stammtv-wss-url" style="min-width: 20rem;">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div id="status" style="color: #259025"></div>
|
||||
<button id="save">Save</button>
|
||||
|
||||
<script src="options.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,32 @@
|
||||
// Saves options to chrome.storage
|
||||
function save_options() {
|
||||
var stammTVBaseUrl = document.getElementById('stammtv-base-url').value;;
|
||||
var stammTVWSSUrl = document.getElementById('stammtv-wss-url').value;;
|
||||
chrome.storage.local.set({
|
||||
baseURL: stammTVBaseUrl,
|
||||
wssURL: stammTVWSSUrl
|
||||
}, function () {
|
||||
// Update status to let user know options were saved.
|
||||
var status = document.getElementById('status');
|
||||
status.textContent = 'Saved.';
|
||||
status.style.color = '00FF00';
|
||||
setTimeout(function () {
|
||||
status.textContent = '';
|
||||
}, 1500);
|
||||
});
|
||||
}
|
||||
|
||||
// Restores select box and checkbox state using the preferences
|
||||
// stored in chrome.storage.
|
||||
function restore_options() {
|
||||
chrome.storage.local.get({
|
||||
baseURL: 'Please fill in.',
|
||||
wssURL: 'Please fill in.'
|
||||
}, function (items) {
|
||||
document.getElementById('stammtv-base-url').value = items.baseURL;
|
||||
document.getElementById('stammtv-wss-url').value = items.wssURL;
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', restore_options);
|
||||
document.getElementById('save').addEventListener('click', save_options);
|
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Popup</title>
|
||||
</head>
|
||||
<body style="min-width: 10rem; min-height: 5rem; display: flex; justify-content: center; align-items: center;">
|
||||
<a href="" id="open-stammtv" target="_blank" style="font-weight: bold; color: #ff0000; border: 1px solid black">→ Take me to StammTV!</a>
|
||||
<script src="popup.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,7 @@
|
||||
function restore_options() {
|
||||
chrome.storage.local.get('baseURL', function (result) {
|
||||
document.getElementById('open-stammtv').href = result.baseURL;
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', restore_options);
|
@ -0,0 +1,58 @@
|
||||
const CONTEXT_MENU_ID = "STAMMTV_ADD_URL_TO_PLAYLIST";
|
||||
const YOUTUBE_URL_REGEX = /^(?:https?:\/\/(?:www\.)?youtu(?:\.be\/|be\.com\/watch\?v=|be\.com\/shorts\/)){1}([^#&?]*)(?:[?&]t=\d+)?.*/;
|
||||
let WEBSOCKET_URL = "";
|
||||
|
||||
let websocket;
|
||||
|
||||
chrome.storage.local.get('wssURL', function (result) {
|
||||
WEBSOCKET_URL = result.wssURL;
|
||||
});
|
||||
|
||||
chrome.contextMenus.create({
|
||||
title: "Zu StammTV Playlist hinzufügen...",
|
||||
contexts: ["link"],
|
||||
id: CONTEXT_MENU_ID
|
||||
});
|
||||
|
||||
chrome.contextMenus.onClicked.addListener(addToStammTV);
|
||||
|
||||
function parseYoutubeURL(url) {
|
||||
let match = url.match(YOUTUBE_URL_REGEX);
|
||||
return (match && match[1].length === 11) ? match[1] : false;
|
||||
}
|
||||
|
||||
function addToStammTV(info, tab) {
|
||||
if (info.menuItemId === CONTEXT_MENU_ID) { //if OUR menu item was clicked
|
||||
let videoId = parseYoutubeURL(info.linkUrl)
|
||||
if (videoId) {
|
||||
const playerReady = {"type":"playerReady"};
|
||||
|
||||
const setVideo = {
|
||||
type: "setVideo",
|
||||
video: videoId,
|
||||
};
|
||||
|
||||
console.log(websocket);
|
||||
if (websocket === undefined
|
||||
|| websocket.readyState !== WebSocket.OPEN) {
|
||||
websocket = new WebSocket(WEBSOCKET_URL);
|
||||
console.log('websocket created');
|
||||
}
|
||||
|
||||
websocket.onopen = function () {
|
||||
console.log('websocket ready');
|
||||
websocket.send(JSON.stringify(playerReady));
|
||||
websocket.send(JSON.stringify(setVideo));
|
||||
console.log(setVideo);
|
||||
};
|
||||
|
||||
setTimeout(function () {
|
||||
websocket.close();
|
||||
console.log('websocket closed');
|
||||
}, 1000);
|
||||
|
||||
} else {
|
||||
console.error('o(一︿一+)o not a valid videoId');
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="GENERAL_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/.." />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="GENERAL_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/.." />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "StammTV Firefox Extension",
|
||||
"description": "Adds a context-menu option to send URLs to StammTV",
|
||||
"version": "1.0",
|
||||
"manifest_version": 2,
|
||||
"background": {
|
||||
"scripts": ["script.js"]
|
||||
},
|
||||
"options_page": "options/options.html",
|
||||
"permissions": [
|
||||
"storage",
|
||||
"contextMenus"
|
||||
],
|
||||
"action": {
|
||||
"default_popup": "popup/popup.html"
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Options for StammTV Chrome Extension</title>
|
||||
</head>
|
||||
<body>
|
||||
<div style="display: grid;">
|
||||
<label>
|
||||
StammTV Base URL: <input type="url" id="stammtv-base-url" style="min-width: 20rem;">
|
||||
</label>
|
||||
<label>
|
||||
StammTV WSS URL: <input type="url" id="stammtv-wss-url" style="min-width: 20rem;">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div id="status" style="color: #259025"></div>
|
||||
<button id="save">Save</button>
|
||||
|
||||
<script src="options.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,32 @@
|
||||
// Saves options to chrome.storage
|
||||
function save_options() {
|
||||
var stammTVBaseUrl = document.getElementById('stammtv-base-url').value;;
|
||||
var stammTVWSSUrl = document.getElementById('stammtv-wss-url').value;;
|
||||
chrome.storage.local.set({
|
||||
baseURL: stammTVBaseUrl,
|
||||
wssURL: stammTVWSSUrl
|
||||
}, function () {
|
||||
// Update status to let user know options were saved.
|
||||
var status = document.getElementById('status');
|
||||
status.textContent = 'Saved.';
|
||||
status.style.color = '00FF00';
|
||||
setTimeout(function () {
|
||||
status.textContent = '';
|
||||
}, 1500);
|
||||
});
|
||||
}
|
||||
|
||||
// Restores select box and checkbox state using the preferences
|
||||
// stored in chrome.storage.
|
||||
function restore_options() {
|
||||
chrome.storage.local.get({
|
||||
baseURL: 'Please fill in.',
|
||||
wssURL: 'Please fill in.'
|
||||
}, function (items) {
|
||||
document.getElementById('stammtv-base-url').value = items.baseURL;
|
||||
document.getElementById('stammtv-wss-url').value = items.wssURL;
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', restore_options);
|
||||
document.getElementById('save').addEventListener('click', save_options);
|
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Popup</title>
|
||||
</head>
|
||||
<body style="min-width: 10rem; min-height: 5rem; display: flex; justify-content: center; align-items: center;">
|
||||
<a href="" id="open-stammtv" target="_blank" style="font-weight: bold; color: #ff0000; border: 1px solid black">→ Take me to StammTV!</a>
|
||||
<script src="popup.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,7 @@
|
||||
function restore_options() {
|
||||
chrome.storage.local.get('baseURL', function (result) {
|
||||
document.getElementById('open-stammtv').href = result.baseURL;
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', restore_options);
|
@ -0,0 +1,58 @@
|
||||
const CONTEXT_MENU_ID = "STAMMTV_ADD_URL_TO_PLAYLIST";
|
||||
const YOUTUBE_URL_REGEX = /^(?:https?:\/\/(?:www\.)?youtu(?:\.be\/|be\.com\/watch\?v=|be\.com\/shorts\/)){1}([^#&?]*)(?:[?&]t=\d+)?.*/;
|
||||
let WEBSOCKET_URL = "";
|
||||
|
||||
let websocket;
|
||||
|
||||
chrome.storage.local.get('wssURL', function (result) {
|
||||
WEBSOCKET_URL = result.wssURL;
|
||||
});
|
||||
|
||||
chrome.contextMenus.create({
|
||||
title: "Zu StammTV Playlist hinzufügen...",
|
||||
contexts: ["link"],
|
||||
id: CONTEXT_MENU_ID
|
||||
});
|
||||
|
||||
chrome.contextMenus.onClicked.addListener(addToStammTV);
|
||||
|
||||
function parseYoutubeURL(url) {
|
||||
let match = url.match(YOUTUBE_URL_REGEX);
|
||||
return (match && match[1].length === 11) ? match[1] : false;
|
||||
}
|
||||
|
||||
function addToStammTV(info, tab) {
|
||||
if (info.menuItemId === CONTEXT_MENU_ID) { //if OUR menu item was clicked
|
||||
let videoId = parseYoutubeURL(info.linkUrl)
|
||||
if (videoId) {
|
||||
const playerReady = {"type":"playerReady"};
|
||||
|
||||
const setVideo = {
|
||||
type: "setVideo",
|
||||
video: videoId,
|
||||
};
|
||||
|
||||
console.log(websocket);
|
||||
if (websocket === undefined
|
||||
|| websocket.readyState !== WebSocket.OPEN) {
|
||||
websocket = new WebSocket(WEBSOCKET_URL);
|
||||
console.log('websocket created');
|
||||
}
|
||||
|
||||
websocket.onopen = function () {
|
||||
console.log('websocket ready');
|
||||
websocket.send(JSON.stringify(playerReady));
|
||||
websocket.send(JSON.stringify(setVideo));
|
||||
console.log(setVideo);
|
||||
};
|
||||
|
||||
setTimeout(function () {
|
||||
websocket.close();
|
||||
console.log('websocket closed');
|
||||
}, 1000);
|
||||
|
||||
} else {
|
||||
console.error('o(一︿一+)o not a valid videoId');
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="GENERAL_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
Loading…
Reference in New Issue