@jxstjh/jhvideo
Version:
HTML5 jhvideo base on MPEG2-TS Stream Player
68 lines • 2.97 kB
JavaScript
/*
* Copyright (C) 2016 Bilibili. All Rights Reserved.
*
* @author zheng qian <xqq@xqq.im>
*
* 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.
*/
import IOController from '../io/io-controller.js';
import { createDefaultConfig } from '../config.js';
var Features = /** @class */ (function () {
function Features() {
}
Features.supportMSEH264Playback = function () {
return window.MediaSource &&
window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"');
};
Features.supportNetworkStreamIO = function () {
var ioctl = new IOController({}, createDefaultConfig());
var loaderType = ioctl.loaderType;
ioctl.destroy();
return loaderType == 'fetch-stream-loader' || loaderType == 'xhr-moz-chunked-loader';
};
Features.getNetworkLoaderTypeName = function () {
var ioctl = new IOController({}, createDefaultConfig());
var loaderType = ioctl.loaderType;
ioctl.destroy();
return loaderType;
};
Features.supportNativeMediaPlayback = function (mimeType) {
if (Features.videoElement == undefined) {
Features.videoElement = window.document.createElement('video');
}
var canPlay = Features.videoElement.canPlayType(mimeType);
return canPlay === 'probably' || canPlay == 'maybe';
};
Features.getFeatureList = function () {
var features = {
msePlayback: false,
mseLivePlayback: false,
networkStreamIO: false,
networkLoaderName: '',
nativeMP4H264Playback: false,
nativeWebmVP8Playback: false,
nativeWebmVP9Playback: false
};
features.msePlayback = Features.supportMSEH264Playback();
features.networkStreamIO = Features.supportNetworkStreamIO();
features.networkLoaderName = Features.getNetworkLoaderTypeName();
features.mseLivePlayback = features.msePlayback && features.networkStreamIO;
features.nativeMP4H264Playback = Features.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"');
features.nativeWebmVP8Playback = Features.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"');
features.nativeWebmVP9Playback = Features.supportNativeMediaPlayback('video/webm; codecs="vp9"');
return features;
};
return Features;
}());
export default Features;
//# sourceMappingURL=features.js.map