@@ -12,7 +12,6 @@ import {
1212} from 'react-native'
1313import noop from 'lodash/noop'
1414import * as c from '../../components/colors'
15- import { TabBarIcon } from '../../components/tabbar-icon'
1615import { callPhone } from '../../components/call-phone'
1716import { Row } from '../../components/layout'
1817import type { TopLevelViewPropsType } from '../../types'
@@ -21,11 +20,19 @@ import type {PlayState, HtmlAudioError, Viewport} from './types'
2120import { ActionButton , ShowCalendarButton , CallButton } from './buttons'
2221import { openUrl } from '../../components/open-url'
2322
24- const image = require ( '../../../../images/streaming/ksto/ksto-logo.png' )
25- const stationNumber = '+15077863602'
26- const kstoLiveUrl = 'https://www.stolaf.edu/multimedia/play/embed/ksto.html'
27-
28- type Props = TopLevelViewPropsType
23+ type Props = TopLevelViewPropsType & {
24+ image : number ,
25+ playerUrl : string ,
26+ stationNumber : string ,
27+ title : string ,
28+ scheduleViewName : string ,
29+ stationName : string ,
30+ source : {
31+ useEmbeddedPlayer : boolean ,
32+ embeddedPlayerUrl : string ,
33+ streamSourceUrl : string ,
34+ } ,
35+ }
2936
3037type State = {
3138 playState : PlayState ,
@@ -34,12 +41,7 @@ type State = {
3441 viewport : Viewport ,
3542}
3643
37- export class KSTOView extends React . PureComponent < Props , State > {
38- static navigationOptions = {
39- tabBarLabel : 'KSTO' ,
40- tabBarIcon : TabBarIcon ( 'radio' ) ,
41- }
42-
44+ export class RadioControllerView extends React . PureComponent < Props , State > {
4345 state = {
4446 playState : 'paused' ,
4547 streamError : null ,
@@ -84,15 +86,15 @@ export class KSTOView extends React.PureComponent<Props, State> {
8486 }
8587
8688 openSchedule = ( ) => {
87- this . props . navigation . navigate ( 'KSTOScheduleView' )
89+ this . props . navigation . navigate ( this . props . scheduleViewName )
8890 }
8991
9092 callStation = ( ) => {
91- callPhone ( stationNumber )
93+ callPhone ( this . props . stationNumber )
9294 }
9395
9496 openStreamWebsite = ( ) => {
95- openUrl ( kstoLiveUrl )
97+ openUrl ( this . props . playerUrl )
9698 }
9799
98100 renderPlayButton = ( state : PlayState ) => {
@@ -156,18 +158,18 @@ export class KSTOView extends React.PureComponent<Props, State> {
156158 < View style = { [ styles . logoWrapper , sideways && landscape . logoWrapper ] } >
157159 < Image
158160 resizeMode = "contain"
159- source = { image }
161+ source = { this . props . image }
160162 style = { [ styles . logo , logoSize ] }
161163 />
162164 </ View >
163165
164166 < View style = { styles . container } >
165167 < View style = { styles . titleWrapper } >
166168 < Text selectable = { true } style = { styles . heading } >
167- St. Olaf College Radio
169+ { this . props . title }
168170 </ Text >
169171 < Text selectable = { true } style = { styles . subHeading } >
170- KSTO 93.1 FM
172+ { this . props . stationName }
171173 </ Text >
172174
173175 { error }
@@ -183,14 +185,17 @@ export class KSTOView extends React.PureComponent<Props, State> {
183185
184186 { Platform . OS !== 'android' ? (
185187 < StreamPlayer
188+ embeddedPlayerUrl = { this . props . source . embeddedPlayerUrl }
186189 onEnded = { this . handleStreamEnd }
187190 // onWaiting={this.handleStreamWait}
188191 onError = { this . handleStreamError }
189192 // onStalled={this.handleStreamStall}
190193 onPause = { this . handleStreamPause }
191194 onPlay = { this . handleStreamPlay }
192195 playState = { this . state . playState }
196+ streamSourceUrl = { this . props . source . streamSourceUrl }
193197 style = { styles . webview }
198+ useEmbeddedPlayer = { this . props . source . useEmbeddedPlayer }
194199 />
195200 ) : null }
196201 </ View >
0 commit comments