hls.js 1.6.0-beta.3.0.canary.10980 → 1.6.0-beta.3.0.canary.10982

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,10 @@
1
- import { fillInMissingAV01Params, mimeTypeForCodec } from './codecs';
1
+ import {
2
+ fillInMissingAV01Params,
3
+ getCodecsForMimeType,
4
+ mimeTypeForCodec,
5
+ userAgentHevcSupportIsInaccurate,
6
+ } from './codecs';
7
+ import { isHEVC } from './mp4-tools';
2
8
  import type { AudioTracksByGroup } from './rendition-helper';
3
9
  import type { Level, VideoRange } from '../types/level';
4
10
  import type { AudioSelectionOption } from '../types/media-playlist';
@@ -115,10 +121,31 @@ export function getMediaDecodingInfoPromise(
115
121
  baseVideoConfiguration.transferFunction =
116
122
  videoRange.toLowerCase() as TransferFunction;
117
123
  }
118
-
124
+ const videoCodecsArray = videoCodecs.split(',');
125
+ // Override Windows Firefox HEVC MediaCapabilities result (https://github.com/video-dev/hls.js/issues/7046)
126
+ const ua = navigator.userAgent;
127
+ if (
128
+ videoCodecsArray.some((videoCodec) => isHEVC(videoCodec)) &&
129
+ userAgentHevcSupportIsInaccurate()
130
+ ) {
131
+ return Promise.resolve({
132
+ supported: false,
133
+ configurations,
134
+ decodingInfoResults: [
135
+ {
136
+ supported: false,
137
+ smooth: false,
138
+ powerEfficient: false,
139
+ },
140
+ ],
141
+ error: new Error(
142
+ `Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent sting: (${ua})`,
143
+ ),
144
+ });
145
+ }
119
146
  configurations.push.apply(
120
147
  configurations,
121
- videoCodecs.split(',').map((videoCodec) => ({
148
+ videoCodecsArray.map((videoCodec) => ({
122
149
  type: 'media-source',
123
150
  video: {
124
151
  ...baseVideoConfiguration,
@@ -187,7 +214,7 @@ function getMediaDecodingInfoKey(config: MediaDecodingConfiguration): string {
187
214
  const { audio, video } = config;
188
215
  const mediaConfig = video || audio;
189
216
  if (mediaConfig) {
190
- const codec = mediaConfig.contentType.split('"')[1];
217
+ const codec = getCodecsForMimeType(mediaConfig.contentType);
191
218
  if (video) {
192
219
  return `r${video.height}x${video.width}f${Math.ceil(video.framerate)}${
193
220
  video.transferFunction || 'sd'
@@ -1012,12 +1012,11 @@ export function parseSamples(
1012
1012
  return seiSamples;
1013
1013
  }
1014
1014
 
1015
- function isHEVC(codec: string) {
1015
+ export function isHEVC(codec: string | undefined) {
1016
1016
  if (!codec) {
1017
1017
  return false;
1018
1018
  }
1019
- const delimit = codec.indexOf('.');
1020
- const baseCodec = delimit < 0 ? codec : codec.substring(0, delimit);
1019
+ const baseCodec = codec.substring(0, 4);
1021
1020
  return (
1022
1021
  baseCodec === 'hvc1' ||
1023
1022
  baseCodec === 'hev1' ||