Skip to content

Instantly share code, notes, and snippets.

@crobinson42
Created March 7, 2017 03:52
Show Gist options
  • Save crobinson42/93597d890785fb87877f93453c2fe54e to your computer and use it in GitHub Desktop.
Save crobinson42/93597d890785fb87877f93453c2fe54e to your computer and use it in GitHub Desktop.
Promise refactor
this.props
.saveSession(this.titleContent.id, this.props.deviceId, true)
.then(response => {
const initialSeekTime = response.payload.data.seconds
this.props.fetchUpFrontAuthToken(this.titleContent.segments[0].mediaKey, this.props.patronInfo.patron.id, this.titleContent.circId)
.then(response => {
this.initializePlayer(this.props.patronInfo.patron.id, this.titleContent.circId, response.payload.data, config.castlabsWidevineUrl, config.castlabsPlayReadyUrl, initialSeekTime)
})
})
let initialSeekTime
this.props
.saveSession(this.titleContent.id, this.props.deviceId, true)
.then(response => {
initialSeekTime = response.payload.data.seconds
return this.props.fetchUpFrontAuthToken(
this.titleContent.segments[0].mediaKey,
this.props.patronInfo.patron.id,
this.titleContent.circId
)
})
.then(response => {
this.initializePlayer(
this.props.patronInfo.patron.id,
this.titleContent.circId,
response.payload.data,
config.castlabsWidevineUrl,
config.castlabsPlayReadyUrl,
initialSeekTime
)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment