mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-03 21:54:49 -04:00
Add receiver app
This commit is contained in:
parent
a7f0bd5a91
commit
8a9a6a5f29
@ -4,3 +4,4 @@ AUTHENTICATION_SECRET=
|
|||||||
POSTGRES_USER=kyoousername
|
POSTGRES_USER=kyoousername
|
||||||
POSTGRES_PASSWORD=kyoopassword
|
POSTGRES_PASSWORD=kyoopassword
|
||||||
POSTGRES_DB=kyooDB
|
POSTGRES_DB=kyooDB
|
||||||
|
CAST_APPLICATION_ID=
|
||||||
|
33
chromecast/.eslintrc.json
Executable file
33
chromecast/.eslintrc.json
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"plugins": ["@typescript-eslint", "header"],
|
||||||
|
"rules": {
|
||||||
|
"header/header": [
|
||||||
|
"error",
|
||||||
|
"block",
|
||||||
|
[
|
||||||
|
"",
|
||||||
|
" * Kyoo - A portable and vast media library solution.",
|
||||||
|
" * Copyright (c) Kyoo.",
|
||||||
|
" *",
|
||||||
|
" * See AUTHORS.md and LICENSE file in the project root for full license information.",
|
||||||
|
" *",
|
||||||
|
" * Kyoo is free software: you can redistribute it and/or modify",
|
||||||
|
" * it under the terms of the GNU General Public License as published by",
|
||||||
|
" * the Free Software Foundation, either version 3 of the License, or",
|
||||||
|
" * any later version.",
|
||||||
|
" *",
|
||||||
|
" * Kyoo is distributed in the hope that it will be useful,",
|
||||||
|
" * but WITHOUT ANY WARRANTY; without even the implied warranty of",
|
||||||
|
" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
|
||||||
|
" * GNU General Public License for more details.",
|
||||||
|
" *",
|
||||||
|
" * You should have received a copy of the GNU General Public License",
|
||||||
|
" * along with Kyoo. If not, see <https://www.gnu.org/licenses/>.",
|
||||||
|
" "
|
||||||
|
],
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
3
chromecast/.gitignore
vendored
Normal file
3
chromecast/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
node_modules
|
||||||
|
.parcel-cache
|
||||||
|
dist
|
6
chromecast/.parcelrc
Normal file
6
chromecast/.parcelrc
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"extends": "@parcel/config-default",
|
||||||
|
"validators": {
|
||||||
|
"*.{ts,tsx}": ["@parcel/validator-typescript"]
|
||||||
|
}
|
||||||
|
}
|
35
chromecast/package.json
Normal file
35
chromecast/package.json
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"name": "kyoo-chromecast",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"private": true,
|
||||||
|
"source": "src/index.html",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "parcel",
|
||||||
|
"build": "parcel build",
|
||||||
|
"format": "prettier --check --ignore-path .gitignore .",
|
||||||
|
"format:fix": "prettier --write --ignore-path .gitignore ."
|
||||||
|
},
|
||||||
|
"prettier": {
|
||||||
|
"useTabs": true,
|
||||||
|
"printWidth": 100,
|
||||||
|
"trailingComma": "all",
|
||||||
|
"plugins": [
|
||||||
|
"prettier-plugin-jsdoc"
|
||||||
|
],
|
||||||
|
"jsdocSingleLineComment": false,
|
||||||
|
"tsdoc": true
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@parcel/validator-typescript": "^2.7.0",
|
||||||
|
"@types/chromecast-caf-receiver": "^6.0.7",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^5.40.1",
|
||||||
|
"@typescript-eslint/parser": "^5.40.1",
|
||||||
|
"eslint": "^8.25.0",
|
||||||
|
"eslint-config-prettier": "^8.5.0",
|
||||||
|
"eslint-plugin-header": "^3.1.1",
|
||||||
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
|
"parcel": "^2.7.0",
|
||||||
|
"prettier": "^2.7.1",
|
||||||
|
"typescript": "^4.8.4"
|
||||||
|
}
|
||||||
|
}
|
12
chromecast/src/index.html
Normal file
12
chromecast/src/index.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script
|
||||||
|
type="text/javascript"
|
||||||
|
src="//www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js"
|
||||||
|
></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<cast-media-player></cast-media-player>
|
||||||
|
<script src="index.ts"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
57
chromecast/src/index.ts
Normal file
57
chromecast/src/index.ts
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Kyoo - A portable and vast media library solution.
|
||||||
|
* Copyright (c) Kyoo.
|
||||||
|
*
|
||||||
|
* See AUTHORS.md and LICENSE file in the project root for full license information.
|
||||||
|
*
|
||||||
|
* Kyoo is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* Kyoo is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const context = cast.framework.CastReceiverContext.getInstance();
|
||||||
|
const playerManager = context.getPlayerManager();
|
||||||
|
|
||||||
|
playerManager.setMessageInterceptor(cast.framework.messages.MessageType.LOAD, (loadRequestData) => {
|
||||||
|
console.log(loadRequestData)
|
||||||
|
const error = new cast.framework.messages.ErrorData(
|
||||||
|
cast.framework.messages.ErrorType.LOAD_FAILED,
|
||||||
|
);
|
||||||
|
if (!loadRequestData.media) {
|
||||||
|
error.reason = cast.framework.messages.ErrorReason.INVALID_PARAMS;
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!loadRequestData.media.entity) {
|
||||||
|
return loadRequestData;
|
||||||
|
}
|
||||||
|
|
||||||
|
return loadRequestData;
|
||||||
|
/* return thirdparty */
|
||||||
|
/* .fetchAssetAndAuth(loadRequestData.media.entity, loadRequestData.credentials) */
|
||||||
|
/* .then((asset) => { */
|
||||||
|
/* if (!asset) { */
|
||||||
|
/* throw cast.framework.messages.ErrorReason.INVALID_REQUEST; */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* loadRequestData.media.contentUrl = asset.url; */
|
||||||
|
/* loadRequestData.media.metadata = asset.metadata; */
|
||||||
|
/* loadRequestData.media.tracks = asset.tracks; */
|
||||||
|
/* return loadRequestData; */
|
||||||
|
/* }) */
|
||||||
|
/* .catch((reason) => { */
|
||||||
|
/* error.reason = reason; // cast.framework.messages.ErrorReason */
|
||||||
|
/* return error; */
|
||||||
|
/* }); */
|
||||||
|
});
|
||||||
|
|
||||||
|
context.start();
|
7
chromecast/tsconfig.json
Normal file
7
chromecast/tsconfig.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"include": ["src/**/*", "./node_modules/@types/chromecast-caf-receiver/*" ],
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es2021",
|
||||||
|
"strict": true
|
||||||
|
}
|
||||||
|
}
|
2261
chromecast/yarn.lock
Normal file
2261
chromecast/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@ -35,7 +35,7 @@ export const CastProvider = () => {
|
|||||||
if (!isAvailable) return;
|
if (!isAvailable) return;
|
||||||
cast.framework.CastContext.getInstance().setOptions({
|
cast.framework.CastContext.getInstance().setOptions({
|
||||||
receiverApplicationId:
|
receiverApplicationId:
|
||||||
process.env.APPLICATION_ID ?? chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,
|
process.env.CAST_APPLICATION_ID ?? chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,
|
||||||
autoJoinPolicy: chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,
|
autoJoinPolicy: chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user