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
3 changes: 2 additions & 1 deletion src/ReactPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,14 @@ export default class ReactPlayer extends Component {
}
renderPlayer = Player => {
const active = Player.canPlay(this.props.url)
const { youtubeConfig, vimeoConfig, dailymotionConfig, ...activeProps } = this.props
const { youtubeConfig, vimeoConfig, dailymotionConfig, wistiaConfig, ...activeProps } = this.props
const props = active ? { ...activeProps, ref: this.ref } : {}
// Only youtube and vimeo config passed to
// inactive players due to preload behaviour
return (
<Player
key={Player.displayName}
wistiaConfig={wistiaConfig}
youtubeConfig={youtubeConfig}
vimeoConfig={vimeoConfig}
dailymotionConfig={dailymotionConfig}
Expand Down
23 changes: 22 additions & 1 deletion src/players/Wistia.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react'
import loadScript from 'load-script'

import Base from './Base'
import { defaultProps } from '../props'

const SDK_URL = '//fast.wistia.com/assets/external/E-v1.js'
const SDK_GLOBAL = 'Wistia'
Expand Down Expand Up @@ -89,9 +90,29 @@ export default class Wistia extends Base {
getFractionLoaded () {
return null
}
getWistiaConfig () {
const { wistiaConfig } = this.props
return Object.assign({}, defaultProps.wistiaConfig, wistiaConfig)
}
getPlayerColor () {
const wistiaConfig = this.getWistiaConfig()
return `playerColor=${wistiaConfig.playerColor}`
}
getPopover () {
const wistiaConfig = this.getWistiaConfig()
return `popover=${wistiaConfig.isPopover}`
}
getPopoverAnimate () {
const { wistiaConfig } = this.props
return `popoverAnimateThumbnail=${wistiaConfig.popoverAnimateThumbnail}`
}
render () {
const id = this.getID(this.props.url)
const className = `wistia_embed wistia_async_${id}`
const playerColor = this.getPlayerColor()
const popover = this.getPopover()
const popoverAnimateThumbnail = this.getPopoverAnimate()
const className = `wistia_embed wistia_async_${id} ${playerColor} ${popover} ${popoverAnimateThumbnail}`

const style = {
width: '100%',
height: '100%',
Expand Down
10 changes: 10 additions & 0 deletions src/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ export const propTypes = {
forceHLS: bool,
forceDASH: bool
}),
wistiaConfig: shape({
isPopover: bool,
popoverAnimateThumbnail: bool,
playerColor: string
}),
onReady: func,
onStart: func,
onPlay: func,
Expand Down Expand Up @@ -92,6 +97,11 @@ export const defaultProps = {
forceHLS: false,
forceDASH: false
},
wistiaConfig: {
isPopover: false,
playerColor: '#cccccc',
popoverAnimateThumbnail: false
},
onReady: function () {},
onStart: function () {},
onPlay: function () {},
Expand Down