Skip to content

Commit

Permalink
chore: Remove unnecessary hints for the compiler and add missing requ…
Browse files Browse the repository at this point in the history
…ires (#5969)
  • Loading branch information
avelad authored Dec 2, 2023
1 parent f3ca869 commit d224933
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 13 deletions.
1 change: 0 additions & 1 deletion demo/common/asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

/**
* @fileoverview
* @suppress {missingRequire}
*/

goog.provide('ShakaDemoAssetInfo');
Expand Down
1 change: 0 additions & 1 deletion demo/common/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

/**
* @fileoverview
* @suppress {missingRequire}
*/

goog.require('ShakaDemoAssetInfo');
Expand Down
4 changes: 4 additions & 0 deletions lib/ads/client_side_ad_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ goog.provide('shaka.ads.ClientSideAdManager');

goog.require('goog.asserts');
goog.require('shaka.ads.ClientSideAd');
goog.require('shaka.log');
goog.require('shaka.util.Dom');
goog.require('shaka.util.EventManager');
goog.require('shaka.util.FakeEvent');
goog.require('shaka.util.IReleasable');

/**
Expand Down
5 changes: 5 additions & 0 deletions lib/ads/media_tailor_ad_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ goog.require('goog.asserts');
goog.require('shaka.ads.MediaTailorAd');
goog.require('shaka.log');
goog.require('shaka.net.NetworkingEngine');
goog.require('goog.Uri');
goog.require('shaka.util.EventManager');
goog.require('shaka.util.Error');
goog.require('shaka.util.FakeEvent');
goog.require('shaka.util.IReleasable');
goog.require('shaka.util.PublicPromise');
goog.require('shaka.util.StringUtils');


Expand Down
4 changes: 4 additions & 0 deletions lib/ads/server_side_ad_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ goog.provide('shaka.ads.ServerSideAdManager');
goog.require('goog.asserts');
goog.require('shaka.ads.ServerSideAd');
goog.require('shaka.log');
goog.require('shaka.util.EventManager');
goog.require('shaka.util.Error');
goog.require('shaka.util.FakeEvent');
goog.require('shaka.util.IReleasable');
goog.require('shaka.util.PublicPromise');


/**
Expand Down
5 changes: 3 additions & 2 deletions lib/media/streaming_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@

/**
* @fileoverview
* @suppress {missingRequire} TODO(b/152540451): this shouldn't be needed
*/

goog.provide('shaka.media.StreamingEngine');

goog.require('goog.asserts');
goog.require('shaka.log');
goog.require('shaka.media.InitSegmentReference');
goog.require('shaka.media.ManifestParser');
goog.require('shaka.media.MediaSourceEngine');
goog.require('shaka.media.SegmentIterator');
goog.require('shaka.media.SegmentReference');
goog.require('shaka.media.SegmentPrefetch');
goog.require('shaka.net.Backoff');
goog.require('shaka.net.NetworkingEngine');
goog.require('shaka.util.BufferUtils');
goog.require('shaka.util.DelayedTick');
goog.require('shaka.util.Destroyer');
goog.require('shaka.util.Error');
Expand All @@ -28,6 +29,7 @@ goog.require('shaka.util.IDestroyable');
goog.require('shaka.util.Id3Utils');
goog.require('shaka.util.ManifestParserUtils');
goog.require('shaka.util.MimeUtils');
goog.require('shaka.util.Mp4BoxParsers');
goog.require('shaka.util.Mp4Parser');
goog.require('shaka.util.Networking');

Expand Down Expand Up @@ -2214,7 +2216,6 @@ shaka.media.StreamingEngine = class {
*
* @return {!Promise.<BufferSource>}
* @private
* @suppress {strictMissingProperties}
*/
async fetch_(mediaState, reference, streamDataCallback) {
if (reference instanceof shaka.media.InitSegmentReference) {
Expand Down
3 changes: 2 additions & 1 deletion lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -5213,7 +5213,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
} else {
// eslint-disable-next-line no-restricted-syntax
if (HTMLMediaElement.prototype.addTextTrack) {
return new shaka.text.SimpleTextDisplayer(this.video_);
return new shaka.text.SimpleTextDisplayer(
this.video_, shaka.Player.TextTrackLabel);
} else {
shaka.log.warning('Text tracks are not supported by the ' +
'browser, disabling.');
Expand Down
13 changes: 7 additions & 6 deletions lib/text/simple_text_displayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

/**
* @fileoverview
* @suppress {missingRequire} TODO(b/152540451): this shouldn't be needed
*/

goog.provide('shaka.text.SimpleTextDisplayer');
Expand All @@ -24,8 +23,11 @@ goog.require('shaka.text.Utils');
* @export
*/
shaka.text.SimpleTextDisplayer = class {
/** @param {HTMLMediaElement} video */
constructor(video) {
/**
* @param {HTMLMediaElement} video
* @param {string} label
*/
constructor(video, label) {
/** @private {TextTrack} */
this.textTrack_ = null;

Expand All @@ -39,7 +41,7 @@ shaka.text.SimpleTextDisplayer = class {
// element.
track.mode = 'disabled';

if (track.label == shaka.Player.TextTrackLabel) {
if (track.label == label) {
this.textTrack_ = track;
}
}
Expand All @@ -49,8 +51,7 @@ shaka.text.SimpleTextDisplayer = class {
// kind to 'subtitles' or 'captions' when creating the TextTrack object.
// The individual text tracks from the manifest will still have their own
// kinds which can be displayed in the app's UI.
this.textTrack_ = video.addTextTrack(
'subtitles', shaka.Player.TextTrackLabel);
this.textTrack_ = video.addTextTrack('subtitles', label);
}
this.textTrack_.mode = 'hidden';
}
Expand Down
3 changes: 2 additions & 1 deletion test/test/util/layout_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,8 @@ shaka.test.NativeTextLayoutTests = class extends shaka.test.TextLayoutTests {

/** @override */
recreateTextDisplayer() {
this.textDisplayer = new shaka.text.SimpleTextDisplayer(this.video);
this.textDisplayer = new shaka.text.SimpleTextDisplayer(
this.video, shaka.Player.TextTrackLabel);
this.textDisplayer.setTextVisibility(true);
}

Expand Down
2 changes: 1 addition & 1 deletion test/text/simple_text_displayer_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('SimpleTextDisplayer', () => {

beforeEach(() => {
video = new shaka.test.FakeVideo();
displayer = new SimpleTextDisplayer(video);
displayer = new SimpleTextDisplayer(video, shaka.Player.TextTrackLabel);

expect(video.textTracks.length).toBe(1);
mockTrack = /** @type {!shaka.test.FakeTextTrack} */ (video.textTracks[0]);
Expand Down

0 comments on commit d224933

Please sign in to comment.