Skip to content

Commit

Permalink
use VideoJS like twitter does
Browse files Browse the repository at this point in the history
  • Loading branch information
mannynotfound committed Feb 25, 2016
1 parent 12d9151 commit 4d49a85
Show file tree
Hide file tree
Showing 4 changed files with 3,761 additions and 7 deletions.
3,758 changes: 3,757 additions & 1 deletion example/tweets.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"moment-twitter": "^0.2.0",
"react": "0.14.0",
"react-dom": "0.14.0",
"react-videojs": "0.0.2",
"twemoji": "^1.4.1",
"twitter-text": "^1.13.2"
}
Expand Down
2 changes: 0 additions & 2 deletions src/components/Tweet/Media.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react'
import Photos from './Photos'
import Video from './Video'


class Media extends React.Component {
render () {
switch (this.props.media[0].type) {
Expand All @@ -28,5 +27,4 @@ Media.defaultProps = {

Media.displayName = 'Media'


export default Media
7 changes: 3 additions & 4 deletions src/components/Tweet/Video.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import styles from './styles'

import VideoJS from 'react-videojs'

class Video extends React.Component {
render () {
Expand All @@ -12,9 +12,9 @@ class Video extends React.Component {

return (
<div className="AdaptiveMedia" style={styles.AdaptiveMedia}>
<video src={videoSrc} controls={!gif} autoPlay={gif} loop={gif} style={styles.video}>
<VideoJS src={videoSrc} controls={!gif} autoPlay={gif} loop={gif} style={styles.video}>
{'Your browser does not support the '}<code>{'video '}</code>{'element.'}
</video>
</VideoJS>
{gif ?
<div className="AdaptiveMedia-badge" style={styles.AdaptiveMediaBadge}>
GIF
Expand All @@ -36,7 +36,6 @@ Video.defaultProps = {

Video.displayName = 'Video'


export default Video


0 comments on commit 4d49a85

Please sign in to comment.