Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add an option to load libraries from custom domain #1833

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add an option to load libraries from custom domain
maxired committed Apr 27, 2024
commit 2d7c7a60523e616e22ec585dd9ba272fbcc5bc17
8 changes: 4 additions & 4 deletions src/players/FilePlayer.js
Original file line number Diff line number Diff line change
@@ -160,15 +160,15 @@ export default class FilePlayer extends Component {
}

load (url) {
const { hlsVersion, hlsOptions, dashVersion, flvVersion } = this.props.config
const { hlsSdkUrl, hlsVersion, hlsOptions, dashVersion, dashSdkUrl, flvVersion, flvSdkUrl } = this.props.config
if (this.hls) {
this.hls.destroy()
}
if (this.dash) {
this.dash.reset()
}
if (this.shouldUseHLS(url)) {
getSDK(HLS_SDK_URL.replace('VERSION', hlsVersion), HLS_GLOBAL).then(Hls => {
getSDK(hlsSdkUrl || HLS_SDK_URL.replace('VERSION', hlsVersion), HLS_GLOBAL).then(Hls => {
this.hls = new Hls(hlsOptions)
this.hls.on(Hls.Events.MANIFEST_PARSED, () => {
this.props.onReady()
@@ -187,7 +187,7 @@ export default class FilePlayer extends Component {
})
}
if (this.shouldUseDASH(url)) {
getSDK(DASH_SDK_URL.replace('VERSION', dashVersion), DASH_GLOBAL).then(dashjs => {
getSDK(dashSdkUrl || DASH_SDK_URL.replace('VERSION', dashVersion), DASH_GLOBAL).then(dashjs => {
this.dash = dashjs.MediaPlayer().create()
this.dash.initialize(this.player, url, this.props.playing)
this.dash.on('error', this.props.onError)
@@ -200,7 +200,7 @@ export default class FilePlayer extends Component {
})
}
if (this.shouldUseFLV(url)) {
getSDK(FLV_SDK_URL.replace('VERSION', flvVersion), FLV_GLOBAL).then(flvjs => {
getSDK(flvSdkUrl || FLV_SDK_URL.replace('VERSION', flvVersion), FLV_GLOBAL).then(flvjs => {
this.flv = flvjs.createPlayer({ type: 'flv', url })
this.flv.attachMediaElement(this.player)
this.flv.on(flvjs.Events.ERROR, (e, data) => {
7 changes: 5 additions & 2 deletions src/props.js
Original file line number Diff line number Diff line change
@@ -66,8 +66,11 @@ export const propTypes = {
forceFLV: bool,
hlsOptions: object,
hlsVersion: string,
hlsSdkUrl: string,
dashVersion: string,
flvVersion: string
dashSdkUrl: string,
flvVersion: string,
flvSdkUrl: string
}),
wistia: shape({
options: object,
@@ -103,7 +106,7 @@ export const propTypes = {
onDisablePIP: func
}

const noop = () => {}
const noop = () => { }

export const defaultProps = {
playing: false,