Skip to content

Commit 01b3e5a

Browse files
authored
Merge pull request #14972 from guardian/doml/remove-sentry-log
Remove sentry logging
2 parents f85084c + 4b83bf6 commit 01b3e5a

File tree

1 file changed

+7
-28
lines changed

1 file changed

+7
-28
lines changed

dotcom-rendering/src/components/SelfHostedVideo.importable.tsx

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -96,35 +96,14 @@ const getOptimisedPosterImage = (mainImage: string): string => {
9696

9797
/**
9898
* Runs a series of browser-specific checks to determine if the video has audio.
99+
* We have run a test to check that all supported browsers are covered by these checks.
99100
*/
100-
const doesVideoHaveAudio = (video: HTMLVideoElement): boolean => {
101-
// If there exists a browser that does not support any of these properties, we are
102-
// unable to detect whether the video has audio. Therefore, we assume it has audio,
103-
// so that the unmute/mute icon is displayed.
104-
if (
105-
!('mozHasAudio' in video) &&
106-
!('webkitAudioDecodedByteCount' in video) &&
107-
!('audioTracks' in video)
108-
) {
109-
// Gather data on what browsers do not support these properties.
110-
window.guardian.modules.sentry.reportError(
111-
new Error(
112-
'Could not determine if video has audio. This is likely due to the browser not supporting the necessary properties.',
113-
),
114-
'self-hosted-video',
115-
);
116-
117-
return true;
118-
}
119-
120-
return (
121-
('mozHasAudio' in video && Boolean(video.mozHasAudio)) ||
122-
('webkitAudioDecodedByteCount' in video &&
123-
Boolean(video.webkitAudioDecodedByteCount)) ||
124-
('audioTracks' in video &&
125-
Boolean((video.audioTracks as { length: number }).length))
126-
);
127-
};
101+
const doesVideoHaveAudio = (video: HTMLVideoElement): boolean =>
102+
('mozHasAudio' in video && Boolean(video.mozHasAudio)) ||
103+
('webkitAudioDecodedByteCount' in video &&
104+
Boolean(video.webkitAudioDecodedByteCount)) ||
105+
('audioTracks' in video &&
106+
Boolean((video.audioTracks as { length: number }).length));
128107

129108
type Props = {
130109
sources: Source[];

0 commit comments

Comments
 (0)