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
6dcb32ce
authored
2015-11-16 15:00:13 -0500
by
David LaPalomento
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'saxena-gaurav-canPlayType' into development
2 parents
8d4ab4b4
9840c6ee
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
src/videojs-hls.js
test/videojs-hls_test.js
src/videojs-hls.js
View file @
6dcb32c
...
...
@@ -95,13 +95,7 @@ videojs.Hls.canPlaySource = function() {
videojs
.
HlsSourceHandler
=
function
(
mode
)
{
return
{
canHandleSource
:
function
(
srcObj
)
{
var
mpegurlRE
=
/^application
\/(?:
x-|vnd
\.
apple
\.)
mpegurl/i
;
// favor native HLS support if it's available
if
(
videojs
.
Hls
.
supportsNativeHls
)
{
return
false
;
}
return
mpegurlRE
.
test
(
srcObj
.
type
);
return
videojs
.
HlsSourceHandler
.
canPlayType
(
srcObj
.
type
);
},
handleSource
:
function
(
source
,
tech
)
{
if
(
mode
===
'flash'
)
{
...
...
@@ -117,10 +111,23 @@ videojs.HlsSourceHandler = function(mode) {
});
tech
.
hls
.
src
(
source
.
src
);
return
tech
.
hls
;
},
canPlayType
:
function
(
type
)
{
return
videojs
.
HlsSourceHandler
.
canPlayType
(
type
);
}
};
};
videojs
.
HlsSourceHandler
.
canPlayType
=
function
(
type
)
{
var
mpegurlRE
=
/^application
\/(?:
x-|vnd
\.
apple
\.)
mpegurl/i
;
// favor native HLS support if it's available
if
(
videojs
.
Hls
.
supportsNativeHls
)
{
return
false
;
}
return
mpegurlRE
.
test
(
type
);
};
// register source handlers with the appropriate techs
if
(
videojs
.
MediaSource
.
supportsNativeMediaSources
())
{
videojs
.
getComponent
(
'Html5'
).
registerSourceHandler
(
videojs
.
HlsSourceHandler
(
'html5'
));
...
...
test/videojs-hls_test.js
View file @
6dcb32c
...
...
@@ -1917,6 +1917,8 @@ test('the source handler supports HLS mime types', function() {
ok
(
videojs
.
HlsSourceHandler
(
techName
).
canHandleSource
({
type
:
'aPplicatiOn/VnD.aPPle.MpEgUrL'
}),
'supports vnd.apple.mpegurl'
);
ok
(
videojs
.
HlsSourceHandler
(
techName
).
canPlayType
(
'aPplicatiOn/VnD.aPPle.MpEgUrL'
),
'supports vnd.apple.mpegurl'
);
ok
(
videojs
.
HlsSourceHandler
(
techName
).
canPlayType
(
'aPplicatiOn/x-MPegUrl'
),
'supports x-mpegurl'
);
ok
(
!
(
videojs
.
HlsSourceHandler
(
techName
).
canHandleSource
({
type
:
'video/mp4'
...
...
@@ -1924,6 +1926,8 @@ test('the source handler supports HLS mime types', function() {
ok
(
!
(
videojs
.
HlsSourceHandler
(
techName
).
canHandleSource
({
type
:
'video/x-flv'
})
instanceof
videojs
.
HlsHandler
),
'does not support flv'
);
ok
(
!
(
videojs
.
HlsSourceHandler
(
techName
).
canPlayType
(
'video/mp4'
)),
'does not support mp4'
);
ok
(
!
(
videojs
.
HlsSourceHandler
(
techName
).
canPlayType
(
'video/x-flv'
)),
'does not support flv'
);
});
});
...
...
Please
register
or
sign in
to post a comment