Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add separate audio and video MIME types to Track API #3892

Merged
merged 1 commit into from Jan 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions externs/shaka/player.js
Expand Up @@ -208,6 +208,8 @@ shaka.extern.BufferedInfo;
* pixelAspectRatio: ?string,
* hdr: ?string,
* mimeType: ?string,
* audioMimeType: ?string,
* videoMimeType: ?string,
* codecs: ?string,
* audioCodec: ?string,
* videoCodec: ?string,
Expand Down Expand Up @@ -267,6 +269,10 @@ shaka.extern.BufferedInfo;
* The video HDR provided in the manifest, if present.
* @property {?string} mimeType
* The MIME type of the content provided in the manifest.
* @property {?string} audioMimeType
* The audio MIME type of the content provided in the manifest.
* @property {?string} videoMimeType
* The video MIME type of the content provided in the manifest.
* @property {?string} codecs
* The audio/video codecs string provided in the manifest, if present.
* @property {?string} audioCodec
Expand Down
13 changes: 13 additions & 0 deletions lib/util/stream_utils.js
Expand Up @@ -846,6 +846,11 @@ shaka.util.StreamUtils = class {
/** @type {?shaka.extern.Stream} */
const video = variant.video;

/** @type {?string} */
const audioMimeType = audio ? audio.mimeType : null;
/** @type {?string} */
const videoMimeType = video ? video.mimeType : null;

/** @type {?string} */
const audioCodec = audio ? audio.codecs : null;
/** @type {?string} */
Expand Down Expand Up @@ -910,6 +915,8 @@ shaka.util.StreamUtils = class {
pixelAspectRatio: null,
hdr: null,
mimeType: mimeType,
audioMimeType: audioMimeType,
videoMimeType: videoMimeType,
codecs: codecs.join(', '),
audioCodec: audioCodec,
videoCodec: videoCodec,
Expand Down Expand Up @@ -977,6 +984,8 @@ shaka.util.StreamUtils = class {
pixelAspectRatio: null,
hdr: null,
mimeType: stream.mimeType,
audioMimeType: null,
videoMimeType: null,
codecs: stream.codecs || null,
audioCodec: null,
videoCodec: null,
Expand Down Expand Up @@ -1049,6 +1058,8 @@ shaka.util.StreamUtils = class {
pixelAspectRatio: null,
hdr: null,
mimeType: stream.mimeType,
audioMimeType: null,
videoMimeType: null,
codecs: null,
audioCodec: null,
videoCodec: null,
Expand Down Expand Up @@ -1167,6 +1178,8 @@ shaka.util.StreamUtils = class {
pixelAspectRatio: null,
hdr: null,
mimeType: null,
audioMimeType: null,
videoMimeType: null,
codecs: null,
audioCodec: null,
videoCodec: null,
Expand Down
4 changes: 4 additions & 0 deletions test/offline/storage_integration.js
Expand Up @@ -1381,6 +1381,8 @@ filterDescribe('Storage', storageSupport, () => {
pixelAspectRatio: '59:54',
hdr: null,
mimeType: 'video/mp4,audio/mp4',
audioMimeType: 'audio/mp4',
videoMimeType: 'video/mp4',
codecs: 'mp4,mp4',
audioCodec: 'mp4',
videoCodec: 'mp4',
Expand Down Expand Up @@ -1423,6 +1425,8 @@ filterDescribe('Storage', storageSupport, () => {
pixelAspectRatio: null,
hdr: null,
mimeType: 'text/vtt',
audioMimeType: null,
videoMimeType: null,
codecs: 'vtt',
audioCodec: null,
videoCodec: null,
Expand Down
24 changes: 24 additions & 0 deletions test/player_unit.js
Expand Up @@ -1115,6 +1115,8 @@ describe('Player', () => {
pixelAspectRatio: '59:54',
hdr: null,
mimeType: 'video/mp4',
audioMimeType: 'audio/mp4',
videoMimeType: 'video/mp4',
codecs: 'avc1.4d401f, mp4a.40.2',
audioCodec: 'mp4a.40.2',
videoCodec: 'avc1.4d401f',
Expand Down Expand Up @@ -1149,6 +1151,8 @@ describe('Player', () => {
pixelAspectRatio: '59:54',
hdr: null,
mimeType: 'video/mp4',
audioMimeType: 'audio/mp4',
videoMimeType: 'video/mp4',
codecs: 'avc1.4d401f, mp4a.40.2',
audioCodec: 'mp4a.40.2',
videoCodec: 'avc1.4d401f',
Expand Down Expand Up @@ -1183,6 +1187,8 @@ describe('Player', () => {
pixelAspectRatio: '59:54',
hdr: null,
mimeType: 'video/mp4',
audioMimeType: 'audio/mp4',
videoMimeType: 'video/mp4',
codecs: 'avc1.4d401f, mp4a.40.2',
audioCodec: 'mp4a.40.2',
videoCodec: 'avc1.4d401f',
Expand Down Expand Up @@ -1217,6 +1223,8 @@ describe('Player', () => {
pixelAspectRatio: '59:54',
hdr: null,
mimeType: 'video/mp4',
audioMimeType: 'audio/mp4',
videoMimeType: 'video/mp4',
codecs: 'avc1.4d401f, mp4a.40.2',
audioCodec: 'mp4a.40.2',
videoCodec: 'avc1.4d401f',
Expand Down Expand Up @@ -1251,6 +1259,8 @@ describe('Player', () => {
pixelAspectRatio: '59:54',
hdr: null,
mimeType: 'video/mp4',
audioMimeType: 'audio/mp4',
videoMimeType: 'video/mp4',
codecs: 'avc1.4d401f, mp4a.40.2',
audioCodec: 'mp4a.40.2',
videoCodec: 'avc1.4d401f',
Expand Down Expand Up @@ -1285,6 +1295,8 @@ describe('Player', () => {
pixelAspectRatio: '59:54',
hdr: null,
mimeType: 'video/mp4',
audioMimeType: 'audio/mp4',
videoMimeType: 'video/mp4',
codecs: 'avc1.4d401f, mp4a.40.2',
audioCodec: 'mp4a.40.2',
videoCodec: 'avc1.4d401f',
Expand Down Expand Up @@ -1319,6 +1331,8 @@ describe('Player', () => {
pixelAspectRatio: '59:54',
hdr: null,
mimeType: 'video/mp4',
audioMimeType: 'audio/mp4',
videoMimeType: 'video/mp4',
codecs: 'avc1.4d401f, mp4a.40.2',
audioCodec: 'mp4a.40.2',
videoCodec: 'avc1.4d401f',
Expand Down Expand Up @@ -1353,6 +1367,8 @@ describe('Player', () => {
pixelAspectRatio: '59:54',
hdr: null,
mimeType: 'video/mp4',
audioMimeType: 'audio/mp4',
videoMimeType: 'video/mp4',
codecs: 'avc1.4d401f, mp4a.40.2',
audioCodec: 'mp4a.40.2',
videoCodec: 'avc1.4d401f',
Expand Down Expand Up @@ -1384,6 +1400,8 @@ describe('Player', () => {
label: 'Spanish',
kind: 'caption',
mimeType: 'text/vtt',
audioMimeType: null,
videoMimeType: null,
codecs: null,
audioCodec: null,
videoCodec: null,
Expand Down Expand Up @@ -1418,6 +1436,8 @@ describe('Player', () => {
label: 'English',
kind: 'caption',
mimeType: 'application/ttml+xml',
audioMimeType: null,
videoMimeType: null,
codecs: null,
audioCodec: null,
videoCodec: null,
Expand Down Expand Up @@ -1452,6 +1472,8 @@ describe('Player', () => {
label: 'English',
kind: 'caption',
mimeType: 'application/ttml+xml',
audioMimeType: null,
videoMimeType: null,
codecs: null,
audioCodec: null,
videoCodec: null,
Expand Down Expand Up @@ -1489,6 +1511,8 @@ describe('Player', () => {
label: null,
kind: null,
mimeType: 'image/jpeg',
audioMimeType: null,
videoMimeType: null,
codecs: null,
audioCodec: null,
videoCodec: null,
Expand Down