| 53 | const audio = new AudioOut({}); |
| 54 | |
| 55 | class ApplicationBehavior { |
| 56 | goToList(application) { |
| 57 | const pane = application.first; |
| 58 | const list = new ChannelList(model); |
| 59 | application.distribute("onUndisplaying"); |
| 60 | model.home = true; |
| 61 | application.run(new TimelineTransition(ChannelPaneTimeline, ChannelListTimeline), pane, list); |
| 62 | } |
| 63 | goToPane(application, channel) { |
| 64 | if (model.current != channel) { |
| 65 | this.onPause(application); |
| 66 | model.current = channel; |
| 67 | } |
| 68 | const list = application.first; |
| 69 | const pane = new ChannelPane(channel); |
| 70 | application.distribute("onUndisplaying"); |
| 71 | model.home = false; |
| 72 | application.run(new TimelineTransition(ChannelListTimeline, ChannelPaneTimeline), list, pane); |
| 73 | } |
| 74 | onCreate(container, $) { |
| 75 | this.going = false; |
| 76 | application.replace(application.first, new ChannelList(model)); |
| 77 | } |
| 78 | onDisplayed(container) { |
| 79 | this.going = false; |
| 80 | } |
| 81 | onGoToList(application) { |
| 82 | if (this.going) |
| 83 | return; |
| 84 | this.going = true; |
| 85 | application.defer("goToList"); |
| 86 | } |
| 87 | onGoToPane(application, channel) { |
| 88 | if (this.going) |
| 89 | return; |
| 90 | this.going = true; |
| 91 | application.defer("goToPane", channel); |
| 92 | } |
| 93 | onPlay(application) { |
| 94 | model.streamer = new MP3Streamer({ |
| 95 | http: device.network.http, |
| 96 | host: "ice2.somafm.com", |
| 97 | path: `/${model.current.id}-128-mp3`, |
| 98 | audio: { |
| 99 | out: audio, |
| 100 | stream: 0 |
| 101 | }, |
| 102 | onReady(state) { |
| 103 | trace(`MP3 Ready: ${state}\n`); |
| 104 | if (state) |
| 105 | audio.start(); |
| 106 | else |
| 107 | audio.stop(); |
| 108 | }, |
| 109 | onError(e) { |
| 110 | trace("MP3 ERROR: ", e, "\n"); |
| 111 | }, |
| 112 | onDone() { |
nothing calls this directly
no outgoing calls
no test coverage detected