Don't fallback to HLS with private videos
This commit is contained in:
parent
9ab330b90d
commit
326f36929a
|
@ -31,6 +31,8 @@ export class HLSOptionsBuilder {
|
||||||
const loader = new this.p2pMediaLoaderModule.Engine(p2pMediaLoaderConfig).createLoaderClass() as P2PMediaLoader
|
const loader = new this.p2pMediaLoaderModule.Engine(p2pMediaLoaderConfig).createLoaderClass() as P2PMediaLoader
|
||||||
|
|
||||||
const p2pMediaLoader: P2PMediaLoaderPluginOptions = {
|
const p2pMediaLoader: P2PMediaLoaderPluginOptions = {
|
||||||
|
requiresAuth: commonOptions.requiresAuth,
|
||||||
|
|
||||||
redundancyUrlManager,
|
redundancyUrlManager,
|
||||||
type: 'application/x-mpegURL',
|
type: 'application/x-mpegURL',
|
||||||
startTime: commonOptions.startTime,
|
startTime: commonOptions.startTime,
|
||||||
|
|
|
@ -44,8 +44,14 @@ class P2pMediaLoaderPlugin extends Plugin {
|
||||||
if (!(videojs as any).Html5Hlsjs) {
|
if (!(videojs as any).Html5Hlsjs) {
|
||||||
logger.warn('HLS.js does not seem to be supported. Try to fallback to built in HLS.')
|
logger.warn('HLS.js does not seem to be supported. Try to fallback to built in HLS.')
|
||||||
|
|
||||||
|
let message: string
|
||||||
if (!player.canPlayType('application/vnd.apple.mpegurl')) {
|
if (!player.canPlayType('application/vnd.apple.mpegurl')) {
|
||||||
const message = 'Cannot fallback to built-in HLS'
|
message = 'Cannot fallback to built-in HLS'
|
||||||
|
} else if (options.requiresAuth) {
|
||||||
|
message = 'Video requires auth which is not compatible to build-in HLS player'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (message) {
|
||||||
logger.warn(message)
|
logger.warn(message)
|
||||||
|
|
||||||
player.ready(() => player.trigger('error', new Error(message)))
|
player.ready(() => player.trigger('error', new Error(message)))
|
||||||
|
|
|
@ -166,6 +166,8 @@ type P2PMediaLoaderPluginOptions = {
|
||||||
startTime: number | string
|
startTime: number | string
|
||||||
|
|
||||||
loader: P2PMediaLoader
|
loader: P2PMediaLoader
|
||||||
|
|
||||||
|
requiresAuth: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export type P2PMediaLoader = {
|
export type P2PMediaLoader = {
|
||||||
|
|
Loading…
Reference in New Issue