mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-24 17:35:10 +03:00
967f339934
externs/shaka/offline.js now represents the data types for Shaka Player Offline V2. All offline shaka player code uses the new version and all V1 and transitional code has been removed. Issue #1047 Change-Id: Ia43f8d8d11426e823629e5fcd27c4e1e0ce400d3
65 lines
1.4 KiB
JavaScript
65 lines
1.4 KiB
JavaScript
/**
|
|
* @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.
|
|
*/
|
|
|
|
goog.provide('shaka.offline.OfflineUri');
|
|
|
|
|
|
/**
|
|
* @param {!number} id
|
|
* @return {!string}
|
|
*/
|
|
shaka.offline.OfflineUri.manifestIdToUri = function(id) {
|
|
return 'offline:manifest/' + id;
|
|
};
|
|
|
|
|
|
/**
|
|
* @param {!string} uri
|
|
* @return {?number}
|
|
*/
|
|
shaka.offline.OfflineUri.uriToManifestId = function(uri) {
|
|
var parts = /^offline:manifest\/([0-9]+)$/.exec(uri);
|
|
|
|
/** @type {?number} */
|
|
var id = parts ? Number(parts[1]) : null;
|
|
|
|
return id;
|
|
};
|
|
|
|
|
|
/**
|
|
* @param {number} id
|
|
* @return {!string}
|
|
*/
|
|
shaka.offline.OfflineUri.segmentIdToUri = function(id) {
|
|
return 'offline:segment/' + id;
|
|
};
|
|
|
|
|
|
/**
|
|
* @param {!string} uri
|
|
* @return {?number}
|
|
*/
|
|
shaka.offline.OfflineUri.uriToSegmentId = function(uri) {
|
|
var parts = /^offline:segment\/([0-9]+)$/.exec(uri);
|
|
|
|
/** @type {?number} */
|
|
var id = parts ? Number(parts[1]) : null;
|
|
|
|
return id;
|
|
};
|