UNPKG

stream-chat-react

Version:

React components to create chat conversations or livestream style chat

26 lines (25 loc) 958 B
export const audioPlayerNotificationsPluginFactory = ({ client, t, }) => { const errors = { 'failed-to-start': new Error(t('Failed to play the recording')), 'not-playable': new Error(t('Recording format is not supported and cannot be reproduced')), 'seek-not-supported': new Error(t('Cannot seek in the recording')), }; return { id: 'AudioPlayerNotificationsPlugin', onError: ({ errCode, error: e }) => { const error = (errCode && errors[errCode]) ?? e ?? new Error(t('Error reproducing the recording')); client?.notifications.addError({ message: error.message, options: { originalError: error, type: 'browser:audio:playback:error', }, origin: { emitter: 'AudioPlayer', }, }); }, }; };