-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
287 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
frontend/assets/javascripts/flux/components/pasokara_preview.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react'; | ||
import FluxComponent from 'flummox/component'; | ||
import PreviewPlayer from './preview_player.jsx'; | ||
|
||
export default class PasokaraPreview extends React.Component { | ||
render() { | ||
let pasokaraId = this.props.params.pasokaraId; | ||
let pasokara = this.props.pasokaraStore.find(pasokaraId); | ||
let component = <div />; | ||
if (pasokara) { | ||
component = ( | ||
<div> | ||
<h3 id="pasokara-preview-title">{pasokara.title}</h3> | ||
<FluxComponent connectToStores={{ | ||
encodings: store => ({ | ||
encoding: store.find(pasokara.id) | ||
}) | ||
}}> | ||
<PreviewPlayer pasokara={pasokara} /> | ||
</FluxComponent> | ||
</div> | ||
); | ||
} else { | ||
this.props.flux.getActions('pasokaras').loadSingle(pasokaraId); | ||
} | ||
|
||
return component; | ||
} | ||
}; | ||
|
||
PasokaraPreview.contextTypes = { | ||
router: React.PropTypes.func.isRequired | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
frontend/assets/javascripts/flux/components/preview_player.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React from 'react'; | ||
|
||
export default class PreviewPlayer extends React.Component { | ||
render() { | ||
let pasokara = this.props.pasokara; | ||
let encoding = this.props.encoding; | ||
let encodingProgress = encoding ? encoding.progress : 0; | ||
|
||
let previewPlayer; | ||
if (pasokara.movie_url) { | ||
previewPlayer = ( | ||
<div id="pasokara-movie-area"> | ||
<div id="pasokara-preview"> | ||
<video id="preview-player" className="preview" controls> | ||
<source type="video/mp4" src={pasokara.movie_url}></source> | ||
</video> | ||
</div> | ||
<div id="record-control"> | ||
<button>Start Rec</button> | ||
<button>Stop Rec</button> | ||
<div id="recorded"> | ||
<audio src={pasokara.recordedUrl} controls></audio> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} else { | ||
previewPlayer = ( | ||
<div id="pasokara-movie-area"> | ||
<div id="pasokara-preview"> | ||
<div className="progress"> | ||
<div className="progress-bar" role="progressbar" aria-valuenow={encodingProgress} aria-valuemin="0" aria-valuemax="100" style={{width: `${encodingProgress}%`}}> | ||
{encodingProgress}% | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
|
||
// 何故かこうしないと動かない | ||
setTimeout(() => { | ||
if (!encoding) | ||
this.props.flux.getActions('pasokaras').encode(pasokara.id); | ||
}, 1); | ||
} | ||
|
||
return ( | ||
<div id="pasokara-preview-player"> | ||
{previewPlayer} | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export default function getCsrfToken() { | ||
let metaTag = document.querySelector('meta[name="csrf-token"]') | ||
if (metaTag) { | ||
return metaTag.content; | ||
} else { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
frontend/assets/javascripts/flux/routes/pasokara_show_route.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import FluxComponent from 'flummox/component'; | ||
import PasokaraPreview from '../components/pasokara_preview.jsx'; | ||
|
||
export default class PasokaraShowRoute extends React.Component { | ||
render() { | ||
return ( | ||
<FluxComponent connectToStores={{ | ||
pasokaras: store => ({ | ||
pasokaraStore: store, | ||
}) | ||
}}> | ||
<PasokaraPreview params={this.props.params} /> | ||
</FluxComponent> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.