assignHlsEvents = function (name, data) {
				if (name === 'hlsError') {
					console.warn(data);
					data = data[1];

					// borrowed from https://video-dev.github.io/hls.js/demo
					if (data.fatal) {
						switch (data.type) {
							case 'mediaError':
								const now = new Date().getTime();
								if (!recoverDecodingErrorDate || (now - recoverDecodingErrorDate) > 3000) {
									recoverDecodingErrorDate = new Date().getTime();
									hlsPlayer.recoverMediaError();
								} else if (!recoverSwapAudioCodecDate || (now - recoverSwapAudioCodecDate) > 3000) {
									recoverSwapAudioCodecDate = new Date().getTime();
									console.warn('Attempting to swap Audio Codec and recover from media error');
									hlsPlayer.swapAudioCodec();
									hlsPlayer.recoverMediaError();
								} else {
									const message = 'Cannot recover, last media error recovery failed';
									mediaElement.generateError(message, node.src);
									console.error(message);
								}
								break;
							case 'networkError':
								if (data.details === 'manifestLoadError') {
									if (index < total && mediaFiles[(index + 1)] !== undefined) {
										node.setSrc(mediaFiles[index++].src);
										node.load();
										node.play();
									} else {
										const message = 'Network error';
										mediaElement.generateError(message, mediaFiles);
										console.error(message);
									}
								} else {
									const message = 'Network error';
									mediaElement.generateError(message, mediaFiles);
									console.error(message);
								}
								break;
							default:
								hlsPlayer.destroy();
								break;
						}
						return;
					}
				}
				const event = createEvent(name, mediaElement);
				event.data = data;
				mediaElement.dispatchEvent(event);
			}
Custom HLS events

These events can be attached to the original node using addEventListener and the name of the event,
not using Hls.Events object
@see https://github.com/video-dev/hls.js/blob/master/src/events.js
@see https://github.com/video-dev/hls.js/blob/master/src/errors.js
@see https://github.com/video-dev/hls.js/blob/master/doc/API.md#runtime-events
@see https://github.com/video-dev/hls.js/blob/master/doc/API.md#errors