Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
videojs-contrib-hls
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
a07f52ee
authored
2016-02-05 17:26:18 -0500
by
brandonocasey
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
added a suffix to previously non-class variables and functions
1 parent
2a4bb073
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
37 deletions
src/playlist-loader.js
src/playlist-loader.js
View file @
a07f52e
...
...
@@ -88,10 +88,10 @@ const updateMaster = function(master, media) {
export
default
class
PlaylistLoader
extends
Stream
{
constructor
(
srcUrl
,
withCredentials
)
{
super
();
this
.
srcUrl
=
srcUrl
;
this
.
withCredentials
=
withCredentials
;
this
.
srcUrl
_
=
srcUrl
;
this
.
withCredentials
_
=
withCredentials
;
this
.
mediaUpdateTimeout
=
null
;
this
.
mediaUpdateTimeout
_
=
null
;
// initialize the loader state
this
.
state
=
'HAVE_NOTHING'
;
...
...
@@ -105,7 +105,7 @@ export default class PlaylistLoader extends Stream {
// no effect when not playing a live stream
this
.
trackExpiredTime_
=
false
;
if
(
!
this
.
srcUrl
)
{
if
(
!
this
.
srcUrl
_
)
{
throw
new
Error
(
'A non-empty playlist URL is required'
);
}
...
...
@@ -123,32 +123,32 @@ export default class PlaylistLoader extends Stream {
}
this
.
state
=
'HAVE_CURRENT_METADATA'
;
this
.
request
=
XhrModule
({
this
.
request
_
=
XhrModule
({
uri
:
resolveUrl
(
this
.
master
.
uri
,
this
.
media
().
uri
),
withCredentials
:
this
.
withCredentials
withCredentials
:
this
.
withCredentials
_
},
(
error
,
request
)
=>
{
if
(
error
)
{
return
this
.
playlistRequestError
(
request
,
this
.
media
().
uri
);
return
this
.
playlistRequestError
_
(
request
,
this
.
media
().
uri
);
}
this
.
haveMetadata
(
request
,
this
.
media
().
uri
);
this
.
haveMetadata
_
(
request
,
this
.
media
().
uri
);
});
});
// request the specified URL
this
.
request
=
XhrModule
({
uri
:
this
.
srcUrl
,
withCredentials
:
this
.
withCredentials
this
.
request
_
=
XhrModule
({
uri
:
this
.
srcUrl
_
,
withCredentials
:
this
.
withCredentials
_
},
(
error
,
request
)
=>
{
let
parser
=
new
m3u8
.
Parser
();
let
i
;
// clear the loader's request reference
this
.
request
=
null
;
this
.
request
_
=
null
;
if
(
error
)
{
this
.
error
=
{
status
:
request
.
status
,
message
:
'HLS playlist request error at URL: '
+
this
.
srcUrl
,
message
:
'HLS playlist request error at URL: '
+
this
.
srcUrl
_
,
responseText
:
request
.
responseText
,
// MEDIA_ERR_NETWORK
code
:
2
...
...
@@ -161,7 +161,7 @@ export default class PlaylistLoader extends Stream {
this
.
state
=
'HAVE_MASTER'
;
parser
.
manifest
.
uri
=
this
.
srcUrl
;
parser
.
manifest
.
uri
=
this
.
srcUrl
_
;
// loaded a master playlist
if
(
parser
.
manifest
.
playlists
)
{
...
...
@@ -175,7 +175,7 @@ export default class PlaylistLoader extends Stream {
}
this
.
trigger
(
'loadedplaylist'
);
if
(
!
this
.
request
)
{
if
(
!
this
.
request
_
)
{
// no media playlist was specifically selected so start
// from the first listed one
this
.
media
(
parser
.
manifest
.
playlists
[
0
]);
...
...
@@ -188,20 +188,20 @@ export default class PlaylistLoader extends Stream {
this
.
master
=
{
uri
:
window
.
location
.
href
,
playlists
:
[{
uri
:
this
.
srcUrl
uri
:
this
.
srcUrl
_
}]
};
this
.
master
.
playlists
[
this
.
srcUrl
]
=
this
.
master
.
playlists
[
0
];
this
.
haveMetadata
(
request
,
this
.
srcUrl
);
this
.
master
.
playlists
[
this
.
srcUrl
_
]
=
this
.
master
.
playlists
[
0
];
this
.
haveMetadata
_
(
request
,
this
.
srcUrl_
);
return
this
.
trigger
(
'loadedmetadata'
);
});
}
playlistRequestError
(
xhr
,
url
,
startingState
)
{
this
.
setBandwidth
(
this
.
request
||
xhr
);
playlistRequestError
_
(
xhr
,
url
,
startingState
)
{
this
.
setBandwidth
(
this
.
request
_
||
xhr
);
// any in-flight request is now finished
this
.
request
=
null
;
this
.
request
_
=
null
;
if
(
startingState
)
{
this
.
state
=
startingState
;
...
...
@@ -219,15 +219,15 @@ export default class PlaylistLoader extends Stream {
// update the playlist loader's state in response to a new or
// updated playlist.
haveMetadata
(
xhr
,
url
)
{
haveMetadata
_
(
xhr
,
url
)
{
let
parser
;
let
refreshDelay
;
let
update
;
this
.
setBandwidth
(
this
.
request
||
xhr
);
this
.
setBandwidth
(
this
.
request
_
||
xhr
);
// any in-flight request is now finished
this
.
request
=
null
;
this
.
request
_
=
null
;
this
.
state
=
'HAVE_METADATA'
;
...
...
@@ -251,7 +251,7 @@ export default class PlaylistLoader extends Stream {
// refresh live playlists after a target duration passes
if
(
!
this
.
media
().
endList
)
{
this
.
clearMediaUpdateTimeout_
();
this
.
mediaUpdateTimeout
=
window
.
setTimeout
(()
=>
{
this
.
mediaUpdateTimeout
_
=
window
.
setTimeout
(()
=>
{
this
.
trigger
(
'mediaupdatetimeout'
);
},
refreshDelay
);
}
...
...
@@ -260,16 +260,16 @@ export default class PlaylistLoader extends Stream {
}
clearMediaUpdateTimeout_
()
{
if
(
this
.
mediaUpdateTimeout
)
{
window
.
clearTimeout
(
this
.
mediaUpdateTimeout
);
if
(
this
.
mediaUpdateTimeout
_
)
{
window
.
clearTimeout
(
this
.
mediaUpdateTimeout
_
);
}
}
requestDispose_
()
{
if
(
this
.
request
)
{
this
.
request
.
onreadystatechange
=
null
;
this
.
request
.
abort
();
this
.
request
=
null
;
if
(
this
.
request
_
)
{
this
.
request
_
.
onreadystatechange
=
null
;
this
.
request
_
.
abort
();
this
.
request
_
=
null
;
}
}
...
...
@@ -339,8 +339,8 @@ export default class PlaylistLoader extends Stream {
this
.
state
=
'SWITCHING_MEDIA'
;
// there is already an outstanding playlist request
if
(
this
.
request
)
{
if
(
resolveUrl
(
this
.
master
.
uri
,
playlist
.
uri
)
===
this
.
request
.
url
)
{
if
(
this
.
request
_
)
{
if
(
resolveUrl
(
this
.
master
.
uri
,
playlist
.
uri
)
===
this
.
request
_
.
url
)
{
// requesting to switch to the same playlist multiple times
// has no effect after the first
return
;
...
...
@@ -349,14 +349,14 @@ export default class PlaylistLoader extends Stream {
}
// request the new playlist
this
.
request
=
XhrModule
({
this
.
request
_
=
XhrModule
({
uri
:
resolveUrl
(
this
.
master
.
uri
,
playlist
.
uri
),
withCredentials
:
this
.
withCredentials
withCredentials
:
this
.
withCredentials
_
},
(
error
,
request
)
=>
{
if
(
error
)
{
return
this
.
playlistRequestError
(
request
,
playlist
.
uri
,
startingState
);
return
this
.
playlistRequestError
_
(
request
,
playlist
.
uri
,
startingState
);
}
this
.
haveMetadata
(
request
,
playlist
.
uri
);
this
.
haveMetadata
_
(
request
,
playlist
.
uri
);
if
(
error
)
{
return
;
...
...
Please
register
or
sign in
to post a comment