fix m3u8 and flv judgment

This commit is contained in:
DIYgod 2016-11-05 22:56:25 +08:00
parent be18f2e0bd
commit ea63bdfe7b
No known key found for this signature in database
GPG Key ID: F8797DD1088C6506
3 changed files with 6 additions and 6 deletions

6
dist/DPlayer.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

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