diff options
author | Chocobozzz <me@florianbigard.com> | 2022-07-15 15:30:14 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-07-18 11:37:18 +0200 |
commit | 42b40636991b97fe818007fab19091764fc5db73 (patch) | |
tree | db431787c06ce898d22e91ff771f795219274fc6 /client/src/standalone/videos/test-embed.ts | |
parent | 654d4ede7fa4d0faa71e49bcfab6b65a686397b2 (diff) | |
download | PeerTube-42b40636991b97fe818007fab19091764fc5db73.tar.gz PeerTube-42b40636991b97fe818007fab19091764fc5db73.tar.zst PeerTube-42b40636991b97fe818007fab19091764fc5db73.zip |
Add ability for client to create server logs
Diffstat (limited to 'client/src/standalone/videos/test-embed.ts')
-rw-r--r-- | client/src/standalone/videos/test-embed.ts | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/client/src/standalone/videos/test-embed.ts b/client/src/standalone/videos/test-embed.ts index 18c338a2d..ab5262902 100644 --- a/client/src/standalone/videos/test-embed.ts +++ b/client/src/standalone/videos/test-embed.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import './test-embed.scss' | 1 | import './test-embed.scss' |
2 | import { PeerTubeResolution, PlayerEventType } from '../player/definitions' | 2 | import { PeerTubeResolution, PlayerEventType } from '../player/definitions' |
3 | import { PeerTubePlayer } from '../player/player' | 3 | import { PeerTubePlayer } from '../player/player' |
4 | import { logger } from '../../root-helpers' | ||
4 | 5 | ||
5 | window.addEventListener('load', async () => { | 6 | window.addEventListener('load', async () => { |
6 | const urlParts = window.location.href.split('/') | 7 | const urlParts = window.location.href.split('/') |
@@ -20,14 +21,14 @@ window.addEventListener('load', async () => { | |||
20 | const mainElement = document.querySelector('#host') | 21 | const mainElement = document.querySelector('#host') |
21 | mainElement.appendChild(iframe) | 22 | mainElement.appendChild(iframe) |
22 | 23 | ||
23 | console.log('Document finished loading.') | 24 | logger.info('Document finished loading.') |
24 | const player = new PeerTubePlayer(document.querySelector('iframe')) | 25 | const player = new PeerTubePlayer(document.querySelector('iframe')) |
25 | 26 | ||
26 | window['player'] = player | 27 | window['player'] = player |
27 | 28 | ||
28 | console.log('Awaiting player ready...') | 29 | logger.info('Awaiting player ready...') |
29 | await player.ready | 30 | await player.ready |
30 | console.log('Player is ready.') | 31 | logger.info('Player is ready.') |
31 | 32 | ||
32 | const monitoredEvents = [ | 33 | const monitoredEvents = [ |
33 | 'pause', | 34 | 'pause', |
@@ -37,8 +38,8 @@ window.addEventListener('load', async () => { | |||
37 | ] | 38 | ] |
38 | 39 | ||
39 | monitoredEvents.forEach(e => { | 40 | monitoredEvents.forEach(e => { |
40 | player.addEventListener(e as PlayerEventType, (param) => console.log(`PLAYER: event '${e}' received`, param)) | 41 | player.addEventListener(e as PlayerEventType, (param) => logger.info(`PLAYER: event '${e}' received`, { param })) |
41 | console.log(`PLAYER: now listening for event '${e}'`) | 42 | logger.info(`PLAYER: now listening for event '${e}'`) |
42 | 43 | ||
43 | player.getCurrentPosition() | 44 | player.getCurrentPosition() |
44 | .then(position => { | 45 | .then(position => { |