Skip to content

Commit

Permalink
Add RTSP stream support to FilePlayer
Browse files Browse the repository at this point in the history
  • Loading branch information
seniorapple committed Jul 25, 2016
1 parent 9fbc404 commit fb6eb52
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/players/FilePlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@ import React from 'react'

import Base from './Base'

const MEDIA_PROTOCOLS = /^rtsp:\/\//i
const VIDEO_EXTENSIONS = /\.(mp4|og[gv]|webm|mov|m4v)($|\?)/i
const AUDIO_EXTENSIONS = /\.(mp3|wav|m4a)($|\?)/i

export default class FilePlayer extends Base {
static displayName = 'FilePlayer'
static canPlay (url) {
return VIDEO_EXTENSIONS.test(url) || AUDIO_EXTENSIONS.test(url)
return (
MEDIA_PROTOCOLS.test(url) ||
VIDEO_EXTENSIONS.test(url) ||
AUDIO_EXTENSIONS.test(url)
)
}
componentDidMount () {
this.player = this.refs.player
Expand Down

0 comments on commit fb6eb52

Please sign in to comment.