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.

45 lines
1.1 KiB

  1. // @ts-check
  2. export const PICTURE_IN_PICTURE_DEPLOY = 'PICTURE_IN_PICTURE_DEPLOY';
  3. export const PICTURE_IN_PICTURE_REMOVE = 'PICTURE_IN_PICTURE_REMOVE';
  4. /**
  5. * @typedef MediaProps
  6. * @property {string} src
  7. * @property {boolean} muted
  8. * @property {number} volume
  9. * @property {number} currentTime
  10. * @property {string} poster
  11. * @property {string} backgroundColor
  12. * @property {string} foregroundColor
  13. * @property {string} accentColor
  14. */
  15. /**
  16. * @param {string} statusId
  17. * @param {string} accountId
  18. * @param {string} playerType
  19. * @param {MediaProps} props
  20. * @return {object}
  21. */
  22. export const deployPictureInPicture = (statusId, accountId, playerType, props) => {
  23. return (dispatch, getState) => {
  24. // Do not open a player for a toot that does not exist
  25. if (getState().hasIn(['statuses', statusId])) {
  26. dispatch({
  27. type: PICTURE_IN_PICTURE_DEPLOY,
  28. statusId,
  29. accountId,
  30. playerType,
  31. props,
  32. });
  33. }
  34. };
  35. };
  36. /*
  37. * @return {object}
  38. */
  39. export const removePictureInPicture = () => ({
  40. type: PICTURE_IN_PICTURE_REMOVE,
  41. });