picture_in_picture.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. });