Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <video src="http://media.w3.org/2010/05/video/movie_300.mp4" controls></video>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.0.4/redux.min.js"></script>
</body>
</html>
 
let reducer = (state = { playing: false, time: 0 }, action) => {
  switch (action.type) {
    case 'TIME_UPDATE':
      return { playing: true, time: action.time };
    default:
      return state;
  }
};
let store = Redux.createStore(reducer);
let unsubscribe = store.subscribe(() => {
  console.log('state changed', store.getState());
});
let video = document.querySelector('video');
video.addEventListener('timeupdate', () => {
  store.dispatch({
    type: 'TIME_UPDATE',
    time: video.currentTime
  });
});
console.log('Click on play to launch the demo');
Output 300px

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers