Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions src/players/FilePlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
Expand All @@ -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) => {
Expand Down
7 changes: 5 additions & 2 deletions src/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -103,7 +106,7 @@ export const propTypes = {
onDisablePIP: func
}

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

export const defaultProps = {
playing: false,
Expand Down
3 changes: 3 additions & 0 deletions types/file.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ export interface FileConfig {
forceFLV?: boolean
hlsOptions?: Record<string, any>
hlsVersion?: string
hlsSdkUrl?: string
dashVersion?: string
dashSdkUrl?: string
flvVersion?: string
flvSdkUrl?: string
}

export interface FilePlayerProps extends BaseReactPlayerProps {
Expand Down