diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/client/live/actions.js | 6 | ||||
| -rw-r--r-- | app/client/live/components/player.component.js | 4 | ||||
| -rw-r--r-- | app/client/live/index.js | 2 | ||||
| -rw-r--r-- | app/client/live/reducer.js | 6 | ||||
| -rw-r--r-- | app/client/socket.js | 28 |
5 files changed, 20 insertions, 26 deletions
diff --git a/app/client/live/actions.js b/app/client/live/actions.js index b604c67..5ee030a 100644 --- a/app/client/live/actions.js +++ b/app/client/live/actions.js @@ -16,7 +16,7 @@ export const list_checkpoints = () => { return { type: 'LOADING_CHECKPOINTS', } } -export const list_datasets = () => { - socket.list_datasets() - return { type: 'LOADING_DATASETS', } +export const list_sequences = () => { + socket.list_sequences() + return { type: 'LOADING_SEQUENCES', } } diff --git a/app/client/live/components/player.component.js b/app/client/live/components/player.component.js index 3c5fc9e..42776ac 100644 --- a/app/client/live/components/player.component.js +++ b/app/client/live/components/player.component.js @@ -3,7 +3,9 @@ import { connect } from 'react-redux' function Player(props) { return ( - <div className='player' /> + <div className='player'> + <canvas width='424' height='256' /> + </div> ) } diff --git a/app/client/live/index.js b/app/client/live/index.js index 51190b2..c438e4b 100644 --- a/app/client/live/index.js +++ b/app/client/live/index.js @@ -14,7 +14,7 @@ class App extends Component { super() props.actions.get_params() props.actions.list_checkpoints() - props.actions.list_datasets() + props.actions.list_sequences() } render(){ const props = this.props diff --git a/app/client/live/reducer.js b/app/client/live/reducer.js index 4c5dba7..c667689 100644 --- a/app/client/live/reducer.js +++ b/app/client/live/reducer.js @@ -5,7 +5,7 @@ const liveInitialState = { error: null, opt: {}, checkpoints: [], - datasets: [], + sequences: [], } const liveReducer = (state = liveInitialState, action) => { @@ -38,10 +38,10 @@ const liveReducer = (state = liveInitialState, action) => { checkpoints: action.checkpoints, } - case 'LIST_DATASETS': + case 'LIST_SEQUENCES': return { ...state, - datasets: action.datasets, + sequences: action.sequences, } default: diff --git a/app/client/socket.js b/app/client/socket.js index cda7058..280e7fe 100644 --- a/app/client/socket.js +++ b/app/client/socket.js @@ -1,7 +1,6 @@ import { store } from './store' let socket = io.connect('/client') -let got_frame = false // SOCKET ACTIONS @@ -27,10 +26,10 @@ socket.on('res', (data) => { checkpoints: data.res, }) break - case 'list_datasets': + case 'list_sequences': store.dispatch({ - type: 'LIST_DATASETS', - datasets: data.res, + type: 'LIST_SEQUENCES', + sequences: data.res, }) break default: @@ -40,35 +39,28 @@ socket.on('res', (data) => { }) socket.on('frame', (data) => { - got_frame = true const blob = new Blob([data.frame], { type: 'image/jpg' }) const url = URL.createObjectURL(blob) const img = new Image () img.onload = function() { URL.revokeObjectURL(url) - const player = document.querySelector('.player') - player.innerHTML = '' - player.appendChild(img) + const player = document.querySelector('.player canvas') + player.getContext('2d') + player.drawImage(img, 0, 0, player.width, player.height) + // player.innerHTML = '' + // player.appendChild(img) } img.src = url }) -setTimeout(() => { - if (!got_frame) { - // socket.emit('cmd', { - // cmd: 'get_last_frame', - // }) - } -}, 500) - export function list_checkpoints() { socket.emit('cmd', { cmd: 'list_checkpoints', }) } -export function list_datasets() { +export function list_sequences() { socket.emit('cmd', { - cmd: 'list_datasets', + cmd: 'list_sequences', }) } export function get_params() { |
