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
cd596f1a
authored
2015-09-29 12:57:58 -0400
by
David LaPalomento
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge pull request #404 from dmlap/flash-mode-loadstart
Ensure Flash mode fires "loadstart"
2 parents
a63f0154
7364f154
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
6 deletions
src/videojs-hls.js
test/videojs-hls_test.js
src/videojs-hls.js
View file @
cd596f1
...
...
@@ -102,6 +102,13 @@ videojs.HlsSourceHandler = function(mode) {
return
mpegurlRE
.
test
(
srcObj
.
type
);
},
handleSource
:
function
(
source
,
tech
)
{
if
(
mode
===
'flash'
)
{
// We need to trigger this asynchronously to give others the chance
// to bind to the event when a source is set at player creation
tech
.
setTimeout
(
function
()
{
tech
.
trigger
(
'loadstart'
);
},
1
);
}
tech
.
hls
=
new
videojs
.
Hls
(
tech
,
{
source
:
source
,
mode
:
mode
...
...
@@ -139,12 +146,6 @@ videojs.Hls.prototype.src = function(src) {
// load the MediaSource into the player
this
.
mediaSource
.
addEventListener
(
'sourceopen'
,
this
.
handleSourceOpen
.
bind
(
this
));
// We need to trigger this asynchronously to give others the chance
// to bind to the event when a source is set at player creation
this
.
setTimeout
(
function
()
{
this
.
tech_
.
trigger
(
'loadstart'
);
}.
bind
(
this
),
1
);
// The index of the next segment to be downloaded in the current
// media playlist. When the current media playlist is live with
// expiring segments, it may be a different value from the media
...
...
test/videojs-hls_test.js
View file @
cd596f1
...
...
@@ -2594,6 +2594,38 @@ test('the source handler supports HLS mime types', function() {
});
});
test
(
'fires loadstart manually if Flash is used'
,
function
()
{
var
tech
=
new
(
videojs
.
extend
(
videojs
.
EventTarget
,
{
buffered
:
function
()
{
return
videojs
.
createTimeRange
();
},
currentTime
:
function
()
{
return
0
;
},
el
:
function
()
{
return
{};
},
preload
:
function
()
{
return
'auto'
;
},
src
:
function
()
{},
setTimeout
:
window
.
setTimeout
}))(),
loadstarts
=
0
;
tech
.
on
(
'loadstart'
,
function
()
{
loadstarts
++
;
});
videojs
.
HlsSourceHandler
(
'flash'
).
handleSource
({
src
:
'movie.m3u8'
,
type
:
'application/x-mpegURL'
},
tech
);
equal
(
loadstarts
,
0
,
'loadstart is not synchronous'
);
clock
.
tick
(
1
);
equal
(
loadstarts
,
1
,
'fired loadstart'
);
});
test
(
'has no effect if native HLS is available'
,
function
()
{
var
player
;
videojs
.
Hls
.
supportsNativeHls
=
true
;
...
...
Please
register
or
sign in
to post a comment