You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
746 B

  1. import { PICTURE_IN_PICTURE_DEPLOY, PICTURE_IN_PICTURE_REMOVE } from 'mastodon/actions/picture_in_picture';
  2. import { TIMELINE_DELETE } from '../actions/timelines';
  3. const initialState = {
  4. statusId: null,
  5. accountId: null,
  6. type: null,
  7. src: null,
  8. muted: false,
  9. volume: 0,
  10. currentTime: 0,
  11. };
  12. export default function pictureInPicture(state = initialState, action) {
  13. switch(action.type) {
  14. case PICTURE_IN_PICTURE_DEPLOY:
  15. return { statusId: action.statusId, accountId: action.accountId, type: action.playerType, ...action.props };
  16. case PICTURE_IN_PICTURE_REMOVE:
  17. return { ...initialState };
  18. case TIMELINE_DELETE:
  19. return (state.statusId === action.id) ? { ...initialState } : state;
  20. default:
  21. return state;
  22. }
  23. };