-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend Player track methods to cover native HLS
Track methods are now implemented for native HLS and other src= playbacks. This will allow the UI to select text and audio languages. This change adds best-effort methods to get track information for src= playbacks, including native HLS on Safari. In many cases, it relies on the audioTracks and videoTracks members of HTMLVideoElement which are only implemented on Safari. They are in the spec, though, so there's no harm in using them when they exist. This is fully parallel to the manifest-based paradigm for MSE-based playbacks. Each of these top-level methods in Player has an "if" to decide which way to supply the requested info, except for the language methods, which now delegate to the track methods. With this, Safari's native HLS can supply audio and text language information to the UI/app, and the UI/app can have some control over those things through the tracks API. I believe this is important to the success of our new iOS support. Issue #997 Issue #382 Change-Id: Icc44a932927fafedda1b62a9d4c6e2ed3dc7db30
- Loading branch information
1 parent
56a48ec
commit 8391fe1
Showing
9 changed files
with
444 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/** | ||
* @license | ||
* Copyright 2016 Google Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* @fileoverview Externs for AudioTrack which are missing from the Closure | ||
* compiler. | ||
* | ||
* @externs | ||
*/ | ||
|
||
/** @constructor */ | ||
function AudioTrack() {} | ||
|
||
/** @type {boolean} */ | ||
AudioTrack.prototype.enabled; | ||
|
||
/** @type {string} */ | ||
AudioTrack.prototype.id; | ||
|
||
/** @type {string} */ | ||
AudioTrack.prototype.kind; | ||
|
||
/** @type {string} */ | ||
AudioTrack.prototype.label; | ||
|
||
/** @type {string} */ | ||
AudioTrack.prototype.language; | ||
|
||
/** @type {SourceBuffer} */ | ||
AudioTrack.prototype.sourceBuffer; | ||
|
||
|
||
/** | ||
* @extends {IArrayLike.<AudioTrack>} | ||
* @extends {EventTarget} | ||
* @interface | ||
*/ | ||
function AudioTrackList() {} | ||
|
||
/** @override */ | ||
AudioTrackList.prototype.addEventListener = | ||
function(type, listener, useCapture) {}; | ||
|
||
/** @override */ | ||
AudioTrackList.prototype.removeEventListener = | ||
function(type, listener, useCapture) {}; | ||
|
||
/** @override */ | ||
AudioTrackList.prototype.dispatchEvent = function(event) {}; | ||
|
||
|
||
/** @type {AudioTrackList} */ | ||
HTMLMediaElement.prototype.audioTracks; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/** | ||
* @license | ||
* Copyright 2016 Google Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* @fileoverview Externs for VideoTrack which are missing from the Closure | ||
* compiler. | ||
* | ||
* @externs | ||
*/ | ||
|
||
/** @constructor */ | ||
function VideoTrack() {} | ||
|
||
/** @type {boolean} */ | ||
VideoTrack.prototype.selected; | ||
|
||
/** @type {string} */ | ||
VideoTrack.prototype.id; | ||
|
||
/** @type {string} */ | ||
VideoTrack.prototype.kind; | ||
|
||
/** @type {string} */ | ||
VideoTrack.prototype.label; | ||
|
||
/** @type {string} */ | ||
VideoTrack.prototype.language; | ||
|
||
/** @type {SourceBuffer} */ | ||
VideoTrack.prototype.sourceBuffer; | ||
|
||
|
||
/** | ||
* @extends {IArrayLike.<VideoTrack>} | ||
* @extends {EventTarget} | ||
* @interface | ||
*/ | ||
function VideoTrackList() {} | ||
|
||
/** @override */ | ||
VideoTrackList.prototype.addEventListener = | ||
function(type, listener, useCapture) {}; | ||
|
||
/** @override */ | ||
VideoTrackList.prototype.removeEventListener = | ||
function(type, listener, useCapture) {}; | ||
|
||
/** @override */ | ||
VideoTrackList.prototype.dispatchEvent = function(event) {}; | ||
|
||
|
||
/** @type {VideoTrackList} */ | ||
HTMLMediaElement.prototype.videoTracks; |
Oops, something went wrong.