Commit 9b2696f3 authored by ali's avatar ali

feat: sdk 导入

parent b1b26209
import type { HWLLSPlayer } from '@/renderer/utils/HWLLS_SDK_Web_2.3.0/export';
declare global {
// eslint-disable-next-line no-unused-vars
interface Window {
HWLLSPlayer: HWLLSPlayer
}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
"dependencies": { "dependencies": {
"axios": "^1.6.2", "axios": "^1.6.2",
"electron-store": "^8.1.0", "electron-store": "^8.1.0",
"EventEmitter": "^1.0.0",
"flv.js": "^1.6.2", "flv.js": "^1.6.2",
"pinia": "^2.1.7", "pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^3.2.0", "pinia-plugin-persistedstate": "^3.2.0",
...@@ -73,4 +74,4 @@ ...@@ -73,4 +74,4 @@
"vue-tsc": "^1.8.22", "vue-tsc": "^1.8.22",
"xvfb-maybe": "^0.2.1" "xvfb-maybe": "^0.2.1"
} }
} }
\ No newline at end of file
...@@ -6,6 +6,6 @@ ...@@ -6,6 +6,6 @@
<body> <body>
<div id="app"></div> <div id="app"></div>
</body> </body>
<!-- <script src="./utils/HWLLS_SDK_Web_2.3.0/lib/HWLLSPlayer.js"></script> --> <script src="./utils/HWLLS_SDK_Web_2.3.0/lib/HWLLSPlayer.js"></script>
<script type="module" src="./main.ts"></script> <script type="module" src="./main.ts"></script>
</html> </html>
import EventEmitter from 'events'; import EventEmitter from 'EventEmitter';
// import { HWLLSSDK } from '@/renderer/utils/HWLLS_SDK_Web_2.3.0/export';
const { createClient, setLogLevel } = (window as any).HWLLSSDK.default;
/** /**
* *
...@@ -68,7 +65,7 @@ export class HwWebRTC extends EventEmitter { ...@@ -68,7 +65,7 @@ export class HwWebRTC extends EventEmitter {
constructor(id: string, log: 'none' | 'error' | 'warn' | 'info' | 'debug' = 'none') { constructor(id: string, log: 'none' | 'error' | 'warn' | 'info' | 'debug' = 'none') {
super(); super();
this.elementId = id; this.elementId = id;
setLogLevel(log); // setLogLevel(log);
} }
/** /**
...@@ -97,7 +94,7 @@ export class HwWebRTC extends EventEmitter { ...@@ -97,7 +94,7 @@ export class HwWebRTC extends EventEmitter {
*/ */
static async isBrowserSupport() { static async isBrowserSupport() {
let check = false; let check = false;
check = await (window as any).HWLLSSDK.default.checkSystemRequirements(); check = await window.HWLLSPlayer.checkSystemRequirements();
return check; return check;
} }
...@@ -114,7 +111,7 @@ export class HwWebRTC extends EventEmitter { ...@@ -114,7 +111,7 @@ export class HwWebRTC extends EventEmitter {
) { ) {
if (this.client) this.destroyed(); if (this.client) this.destroyed();
this.startPlayOptions = options; this.startPlayOptions = options;
this.client = createClient('webrtc'); this.client = window.HWLLSPlayer.createClient('webrtc');
await this.client.startPlay(url, { await this.client.startPlay(url, {
elementId: this.elementId, elementId: this.elementId,
...this.startPlayOptions ...this.startPlayOptions
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import http from '@/renderer/utils/http'; import http from '@/renderer/utils/http';
import { HwWebRTC } from './HwWebRTC'; import { HwWebRTC } from './HwWebRTC';
import { guid } from '@/renderer/utils/index'; import { guid } from '@/renderer/utils/index';
import EventEmitter from 'events'; import EventEmitter from 'EventEmitter';
const HOST = 'http://122.51.32.12:9000'; const HOST = 'http://122.51.32.12:9000';
......
export * from './lib/HWLLSPlayer'; export * as HWLLSPlayer from './lib/HWLLSPlayer';
\ No newline at end of file \ No newline at end of file
...@@ -21,11 +21,11 @@ ...@@ -21,11 +21,11 @@
}, },
"lib": ["esnext", "dom"] "lib": ["esnext", "dom"]
}, },
"include": ["src/*.ts", "src/*.d.ts", "src/renderer"], "include": ["src/*.ts", "src/*.d.ts", "src/renderer", "./env.d.ts"],
"references": [ "references": [
{ {
"path": "./tsconfig.node.json" "path": "./tsconfig.node.json"
} }
], ],
"exclude": ["node_modules", "dist", "rollup.config.js", "*.json", "*.js"] "exclude": ["node_modules", "dist", "rollup.config.js", "*.json", "*.js", "src/renderer/utils/HWLLS_SDK_Web_2.3.0/**'"]
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment