Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const { navigation: { state: { params: { item } } } } = this.props
console.log('onReady', data)
console.log('item', item)
console.log('castState', GoogleCast.getCastState())
const { casting } = this.state
if (casting || await GoogleCast.getCastState().toLowerCase() === 'connected') {
const { navigation: { state: { params: { item } } } } = this.props
console.log('data.url', data.url)
const mediaUrl = this.serverUrl + data.url.replace(RNFS.CachesDirectoryPath, '')
console.log('\n\n\nmediaUrl', mediaUrl)
GoogleCast.castMedia({
title : item.title,
subtitle: item.summary,
// studio: video.studio,
// duration: video.duration,
mediaUrl,
imageUrl : item.images.fanart.high,
posterUrl: item.images.poster.high,
})
GoogleCast.launchExpandedControls()
} else {
this.setState({
url: data.url,
cast(video) {
GoogleCast.getCastDevice().then(console.log)
GoogleCast.castMedia(video)
GoogleCast.launchExpandedControls()
this.sendMessage()
}
handleStartCasting = (force = false) => {
const { item } = this.props
const { casting, mediaUrl } = this.state
if (force || casting) {
Orientation.lockToPortrait()
GoogleCast.castMedia({
title: (
item.type === 'episode'
? `${item.show.title}: ${item.number}. ${item.title}`
: item.title
),
subtitle: item.synopsis,
mediaUrl: `${mediaUrl}?device=chromecast`,
posterUrl: item.type === 'episode'
? item.show.images.poster.high
: item.images.poster.high,
})
}
}