diff options
author | Chocobozzz <me@florianbigard.com> | 2023-05-10 11:25:24 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-05-10 11:25:24 +0200 |
commit | 89fc0142625126b0a2923c9d625be5d201354bb7 (patch) | |
tree | fd637bf146b1caee16b2ce7286407d97fc1f03c6 | |
parent | 34023e12534f22f28d0b5afc1db3fdf2fd1e7e60 (diff) | |
download | PeerTube-89fc0142625126b0a2923c9d625be5d201354bb7.tar.gz PeerTube-89fc0142625126b0a2923c9d625be5d201354bb7.tar.zst PeerTube-89fc0142625126b0a2923c9d625be5d201354bb7.zip |
Catch metrics error
-rw-r--r-- | client/src/assets/player/shared/metrics/metrics-plugin.ts | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/client/src/assets/player/shared/metrics/metrics-plugin.ts b/client/src/assets/player/shared/metrics/metrics-plugin.ts index 0e296bef6..2aae3e90a 100644 --- a/client/src/assets/player/shared/metrics/metrics-plugin.ts +++ b/client/src/assets/player/shared/metrics/metrics-plugin.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import videojs from 'video.js' | 1 | import videojs from 'video.js' |
2 | import { PlaybackMetricCreate } from '../../../../../../shared/models' | 2 | import { PlaybackMetricCreate } from '../../../../../../shared/models' |
3 | import { MetricsPluginOptions, PlayerMode, PlayerNetworkInfo } from '../../types' | 3 | import { MetricsPluginOptions, PlayerMode, PlayerNetworkInfo } from '../../types' |
4 | import { logger } from '@root-helpers/logger' | ||
4 | 5 | ||
5 | const Plugin = videojs.getPlugin('plugin') | 6 | const Plugin = videojs.getPlugin('plugin') |
6 | 7 | ||
@@ -99,6 +100,7 @@ class MetricsPlugin extends Plugin { | |||
99 | const headers = new Headers({ 'Content-type': 'application/json; charset=UTF-8' }) | 100 | const headers = new Headers({ 'Content-type': 'application/json; charset=UTF-8' }) |
100 | 101 | ||
101 | return fetch(this.metricsUrl, { method: 'POST', body: JSON.stringify(body), headers }) | 102 | return fetch(this.metricsUrl, { method: 'POST', body: JSON.stringify(body), headers }) |
103 | .catch(err => logger.error('Cannot send metrics to the server.', err)) | ||
102 | }, this.CONSTANTS.METRICS_INTERVAL) | 104 | }, this.CONSTANTS.METRICS_INTERVAL) |
103 | } | 105 | } |
104 | 106 | ||