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

fix(types): Adds track and track list types to typescript exports #8486

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -5163,51 +5163,56 @@ class Player extends Component {
*
* @link https://html.spec.whatwg.org/multipage/embedded-content.html#videotracklist
*
* @return {VideoTrackList}
* @returns {import("./tracks/video-track-list").VideoTrackList}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use the better import syntax now

/** @import { VideoTrackList } from './tracks/video-track-list' */

...

@returns {VideoTrackList}

* the current video track list
*
* @method Player.prototype.videoTracks
*/
Player.prototype.videoTracks = () => {};

/**
* Get the {@link AudioTrackList}
*
* @link https://html.spec.whatwg.org/multipage/embedded-content.html#audiotracklist
*
* @return {AudioTrackList}
* @return {import("./tracks/audio-track-list").AudioTrackList}
* the current audio track list
*
* @method Player.prototype.audioTracks
*/
Player.prototype.audioTracks = () => {};

/**
* Get the {@link TextTrackList}
*
* @link http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#dom-media-texttracks
*
* @return {TextTrackList}
* @return {import("./tracks/text-track-list").TextTrackList}
* the current text track list
*
* @method Player.prototype.textTracks
*/
Player.prototype.textTracks = () => {};

/**
* Get the remote {@link TextTrackList}
*
* @return {TextTrackList}
* @return {import("./tracks/text-track-list").TextTrackList}
* The current remote text track list
*
* @method Player.prototype.remoteTextTracks
*/
Player.prototype.remoteTextTracks = () => {};

/**
* Get the remote {@link HtmlTrackElementList} tracks.
*
* @return {HtmlTrackElementList}
* @return {import("./tracks/html-track-element-list").HtmlTrackElementList}
* The current remote text track element list
*
* @method Player.prototype.remoteTextTrackEls
*/
Player.prototype.remoteTextTrackEls = () => {};

TRACK_TYPES.names.forEach(function(name) {
const props = TRACK_TYPES[name];
Expand Down
2 changes: 1 addition & 1 deletion src/js/tracks/audio-track-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const disableOthers = function(list, track) {
* @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#audiotracklist}
* @extends TrackList
*/
class AudioTrackList extends TrackList {
export class AudioTrackList extends TrackList {

/**
* Create an instance of this class.
Expand Down
2 changes: 1 addition & 1 deletion src/js/tracks/html-track-element-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* The current list of {@link HtmlTrackElement}s.
*/
class HtmlTrackElementList {
export class HtmlTrackElementList {

/**
* Create an instance of this class.
Expand Down
2 changes: 1 addition & 1 deletion src/js/tracks/text-track-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import TrackList from './track-list';
* @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttracklist}
* @extends TrackList
*/
class TextTrackList extends TrackList {
export class TextTrackList extends TrackList {

/**
* Add a {@link TextTrack} to the `TextTrackList`
Expand Down
2 changes: 1 addition & 1 deletion src/js/tracks/track-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {isEvented} from '../mixins/evented';
*
* @extends EventTarget
*/
class TrackList extends EventTarget {
export class TrackList extends EventTarget {
/**
* Create an instance of this class
*
Expand Down
2 changes: 1 addition & 1 deletion src/js/tracks/video-track-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const disableOthers = function(list, track) {
* @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#videotracklist}
* @extends TrackList
*/
class VideoTrackList extends TrackList {
export class VideoTrackList extends TrackList {

/**
* Create an instance of this class.
Expand Down
8 changes: 8 additions & 0 deletions src/js/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ import Plugin from './plugin';
import * as Fn from './utils/fn.js';
import * as Num from './utils/num.js';
import * as Str from './utils/str.js';
import TrackList from './tracks/track-list.js';
import TextTrack from './tracks/text-track.js';
import TextTrackList from './tracks/text-track-list.js';
import AudioTrack from './tracks/audio-track.js';
import AudioTrackList from './tracks/audio-track-list.js';
import VideoTrack from './tracks/video-track.js';
import VideoTrackList from './tracks/video-track-list.js';
import { deprecateForMajor } from './utils/deprecate';
import * as Time from './utils/time.js';
import log, { createLogger } from './utils/log.js';
Expand Down Expand Up @@ -551,9 +555,13 @@ videojs.trigger = Events.trigger;
*/
videojs.xhr = xhr;

videojs.TrackList = TrackList;
videojs.TextTrack = TextTrack;
videojs.TextTrackList = TextTrackList;
videojs.AudioTrack = AudioTrack;
videojs.AudioTrackList = AudioTrackList;
videojs.VideoTrack = VideoTrack;
videojs.VideoTrackList = VideoTrackList;

[
'isEl',
Expand Down