fix m3u8 and flv judgment

This commit is contained in:
DIYgod
2016-11-05 22:56:25 +08:00
parent be18f2e0bd
commit ea63bdfe7b
3 changed files with 6 additions and 6 deletions
+3 -3
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -283,7 +283,7 @@ class DPlayer {
this.video = this.element.getElementsByClassName('dplayer-video')[0];
// Support HTTP Live Streaming
if (this.option.video.url.match(/(m3u8)$/i) && Hls.isSupported()) {
if (/(m3u8\?|m3u8$)/i.exec(this.option.video.url) && Hls.isSupported()) {
this.element.getElementsByClassName('dplayer-time')[0].style.display = 'none';
const hls = new Hls();
hls.attachMedia(this.video);
@@ -296,7 +296,7 @@ class DPlayer {
}
// Support FLV
if (this.option.video.url.match(/(flv)$/i) && flvjs.isSupported()) {
if (/(flv\?|flv$)/i.exec(this.option.video.url) && flvjs.isSupported()) {
const flvPlayer = flvjs.createPlayer({
type: 'flv',
url: this.option.video.url