a07f52ee by brandonocasey

added a suffix to previously non-class variables and functions

1 parent 2a4bb073
...@@ -88,10 +88,10 @@ const updateMaster = function(master, media) { ...@@ -88,10 +88,10 @@ const updateMaster = function(master, media) {
88 export default class PlaylistLoader extends Stream { 88 export default class PlaylistLoader extends Stream {
89 constructor(srcUrl, withCredentials) { 89 constructor(srcUrl, withCredentials) {
90 super(); 90 super();
91 this.srcUrl = srcUrl; 91 this.srcUrl_ = srcUrl;
92 this.withCredentials = withCredentials; 92 this.withCredentials_ = withCredentials;
93 93
94 this.mediaUpdateTimeout = null; 94 this.mediaUpdateTimeout_ = null;
95 95
96 // initialize the loader state 96 // initialize the loader state
97 this.state = 'HAVE_NOTHING'; 97 this.state = 'HAVE_NOTHING';
...@@ -105,7 +105,7 @@ export default class PlaylistLoader extends Stream { ...@@ -105,7 +105,7 @@ export default class PlaylistLoader extends Stream {
105 // no effect when not playing a live stream 105 // no effect when not playing a live stream
106 this.trackExpiredTime_ = false; 106 this.trackExpiredTime_ = false;
107 107
108 if (!this.srcUrl) { 108 if (!this.srcUrl_) {
109 throw new Error('A non-empty playlist URL is required'); 109 throw new Error('A non-empty playlist URL is required');
110 } 110 }
111 111
...@@ -123,32 +123,32 @@ export default class PlaylistLoader extends Stream { ...@@ -123,32 +123,32 @@ export default class PlaylistLoader extends Stream {
123 } 123 }
124 124
125 this.state = 'HAVE_CURRENT_METADATA'; 125 this.state = 'HAVE_CURRENT_METADATA';
126 this.request = XhrModule({ 126 this.request_ = XhrModule({
127 uri: resolveUrl(this.master.uri, this.media().uri), 127 uri: resolveUrl(this.master.uri, this.media().uri),
128 withCredentials: this.withCredentials 128 withCredentials: this.withCredentials_
129 }, (error, request) => { 129 }, (error, request) => {
130 if (error) { 130 if (error) {
131 return this.playlistRequestError(request, this.media().uri); 131 return this.playlistRequestError_(request, this.media().uri);
132 } 132 }
133 this.haveMetadata(request, this.media().uri); 133 this.haveMetadata_(request, this.media().uri);
134 }); 134 });
135 }); 135 });
136 136
137 // request the specified URL 137 // request the specified URL
138 this.request = XhrModule({ 138 this.request_ = XhrModule({
139 uri: this.srcUrl, 139 uri: this.srcUrl_,
140 withCredentials: this.withCredentials 140 withCredentials: this.withCredentials_
141 }, (error, request) => { 141 }, (error, request) => {
142 let parser = new m3u8.Parser(); 142 let parser = new m3u8.Parser();
143 let i; 143 let i;
144 144
145 // clear the loader's request reference 145 // clear the loader's request reference
146 this.request = null; 146 this.request_ = null;
147 147
148 if (error) { 148 if (error) {
149 this.error = { 149 this.error = {
150 status: request.status, 150 status: request.status,
151 message: 'HLS playlist request error at URL: ' + this.srcUrl, 151 message: 'HLS playlist request error at URL: ' + this.srcUrl_,
152 responseText: request.responseText, 152 responseText: request.responseText,
153 // MEDIA_ERR_NETWORK 153 // MEDIA_ERR_NETWORK
154 code: 2 154 code: 2
...@@ -161,7 +161,7 @@ export default class PlaylistLoader extends Stream { ...@@ -161,7 +161,7 @@ export default class PlaylistLoader extends Stream {
161 161
162 this.state = 'HAVE_MASTER'; 162 this.state = 'HAVE_MASTER';
163 163
164 parser.manifest.uri = this.srcUrl; 164 parser.manifest.uri = this.srcUrl_;
165 165
166 // loaded a master playlist 166 // loaded a master playlist
167 if (parser.manifest.playlists) { 167 if (parser.manifest.playlists) {
...@@ -175,7 +175,7 @@ export default class PlaylistLoader extends Stream { ...@@ -175,7 +175,7 @@ export default class PlaylistLoader extends Stream {
175 } 175 }
176 176
177 this.trigger('loadedplaylist'); 177 this.trigger('loadedplaylist');
178 if (!this.request) { 178 if (!this.request_) {
179 // no media playlist was specifically selected so start 179 // no media playlist was specifically selected so start
180 // from the first listed one 180 // from the first listed one
181 this.media(parser.manifest.playlists[0]); 181 this.media(parser.manifest.playlists[0]);
...@@ -188,20 +188,20 @@ export default class PlaylistLoader extends Stream { ...@@ -188,20 +188,20 @@ export default class PlaylistLoader extends Stream {
188 this.master = { 188 this.master = {
189 uri: window.location.href, 189 uri: window.location.href,
190 playlists: [{ 190 playlists: [{
191 uri: this.srcUrl 191 uri: this.srcUrl_
192 }] 192 }]
193 }; 193 };
194 this.master.playlists[this.srcUrl] = this.master.playlists[0]; 194 this.master.playlists[this.srcUrl_] = this.master.playlists[0];
195 this.haveMetadata(request, this.srcUrl); 195 this.haveMetadata_(request, this.srcUrl_);
196 return this.trigger('loadedmetadata'); 196 return this.trigger('loadedmetadata');
197 }); 197 });
198 } 198 }
199 199
200 playlistRequestError(xhr, url, startingState) { 200 playlistRequestError_(xhr, url, startingState) {
201 this.setBandwidth(this.request || xhr); 201 this.setBandwidth(this.request_ || xhr);
202 202
203 // any in-flight request is now finished 203 // any in-flight request is now finished
204 this.request = null; 204 this.request_ = null;
205 205
206 if (startingState) { 206 if (startingState) {
207 this.state = startingState; 207 this.state = startingState;
...@@ -219,15 +219,15 @@ export default class PlaylistLoader extends Stream { ...@@ -219,15 +219,15 @@ export default class PlaylistLoader extends Stream {
219 219
220 // update the playlist loader's state in response to a new or 220 // update the playlist loader's state in response to a new or
221 // updated playlist. 221 // updated playlist.
222 haveMetadata(xhr, url) { 222 haveMetadata_(xhr, url) {
223 let parser; 223 let parser;
224 let refreshDelay; 224 let refreshDelay;
225 let update; 225 let update;
226 226
227 this.setBandwidth(this.request || xhr); 227 this.setBandwidth(this.request_ || xhr);
228 228
229 // any in-flight request is now finished 229 // any in-flight request is now finished
230 this.request = null; 230 this.request_ = null;
231 231
232 this.state = 'HAVE_METADATA'; 232 this.state = 'HAVE_METADATA';
233 233
...@@ -251,7 +251,7 @@ export default class PlaylistLoader extends Stream { ...@@ -251,7 +251,7 @@ export default class PlaylistLoader extends Stream {
251 // refresh live playlists after a target duration passes 251 // refresh live playlists after a target duration passes
252 if (!this.media().endList) { 252 if (!this.media().endList) {
253 this.clearMediaUpdateTimeout_(); 253 this.clearMediaUpdateTimeout_();
254 this.mediaUpdateTimeout = window.setTimeout(() => { 254 this.mediaUpdateTimeout_ = window.setTimeout(() => {
255 this.trigger('mediaupdatetimeout'); 255 this.trigger('mediaupdatetimeout');
256 }, refreshDelay); 256 }, refreshDelay);
257 } 257 }
...@@ -260,16 +260,16 @@ export default class PlaylistLoader extends Stream { ...@@ -260,16 +260,16 @@ export default class PlaylistLoader extends Stream {
260 } 260 }
261 261
262 clearMediaUpdateTimeout_() { 262 clearMediaUpdateTimeout_() {
263 if (this.mediaUpdateTimeout) { 263 if (this.mediaUpdateTimeout_) {
264 window.clearTimeout(this.mediaUpdateTimeout); 264 window.clearTimeout(this.mediaUpdateTimeout_);
265 } 265 }
266 } 266 }
267 267
268 requestDispose_() { 268 requestDispose_() {
269 if (this.request) { 269 if (this.request_) {
270 this.request.onreadystatechange = null; 270 this.request_.onreadystatechange = null;
271 this.request.abort(); 271 this.request_.abort();
272 this.request = null; 272 this.request_ = null;
273 } 273 }
274 } 274 }
275 275
...@@ -339,8 +339,8 @@ export default class PlaylistLoader extends Stream { ...@@ -339,8 +339,8 @@ export default class PlaylistLoader extends Stream {
339 this.state = 'SWITCHING_MEDIA'; 339 this.state = 'SWITCHING_MEDIA';
340 340
341 // there is already an outstanding playlist request 341 // there is already an outstanding playlist request
342 if (this.request) { 342 if (this.request_) {
343 if (resolveUrl(this.master.uri, playlist.uri) === this.request.url) { 343 if (resolveUrl(this.master.uri, playlist.uri) === this.request_.url) {
344 // requesting to switch to the same playlist multiple times 344 // requesting to switch to the same playlist multiple times
345 // has no effect after the first 345 // has no effect after the first
346 return; 346 return;
...@@ -349,14 +349,14 @@ export default class PlaylistLoader extends Stream { ...@@ -349,14 +349,14 @@ export default class PlaylistLoader extends Stream {
349 } 349 }
350 350
351 // request the new playlist 351 // request the new playlist
352 this.request = XhrModule({ 352 this.request_ = XhrModule({
353 uri: resolveUrl(this.master.uri, playlist.uri), 353 uri: resolveUrl(this.master.uri, playlist.uri),
354 withCredentials: this.withCredentials 354 withCredentials: this.withCredentials_
355 }, (error, request) => { 355 }, (error, request) => {
356 if (error) { 356 if (error) {
357 return this.playlistRequestError(request, playlist.uri, startingState); 357 return this.playlistRequestError_(request, playlist.uri, startingState);
358 } 358 }
359 this.haveMetadata(request, playlist.uri); 359 this.haveMetadata_(request, playlist.uri);
360 360
361 if (error) { 361 if (error) {
362 return; 362 return;
......