diff --git a/frontend/app/components/Session/WebPlayer.tsx b/frontend/app/components/Session/WebPlayer.tsx index 4786c4bff..7d6668168 100644 --- a/frontend/app/components/Session/WebPlayer.tsx +++ b/frontend/app/components/Session/WebPlayer.tsx @@ -24,7 +24,7 @@ const TABS = { let playerInst: IPlayerContext['player'] | undefined; function WebPlayer(props: any) { - const { session, toggleFullscreen, closeBottomBlock, fullscreen, fetchList } = props; + const { session, toggleFullscreen, closeBottomBlock, fullscreen, fetchList, startedAt } = props; const { notesStore, sessionStore } = useStore(); const [activeTab, setActiveTab] = useState(''); const [noteItem, setNoteItem] = useState(undefined); @@ -79,7 +79,7 @@ function WebPlayer(props: any) { if (jumpToTime || shouldAdjustOffset) { if (jumpToTime > visualOffset) { - contextValue.player.jump(parseInt(jumpToTime)); + contextValue.player.jump(parseInt(String(jumpToTime - startedAt))); } else { contextValue.player.jump(visualOffset); setAdjusted(true); @@ -168,6 +168,7 @@ export default connect( fullscreen: state.getIn(['components', 'player', 'fullscreen']), showEvents: state.get('showEvents'), members: state.getIn(['members', 'list']), + startedAt: state.getIn(['sessions', 'current']).startedAt || 0, }), { toggleFullscreen, diff --git a/frontend/app/components/shared/SharePopup/SessionCopyLink/SessionCopyLink.tsx b/frontend/app/components/shared/SharePopup/SessionCopyLink/SessionCopyLink.tsx index 6131e9c8f..ce41b3800 100644 --- a/frontend/app/components/shared/SharePopup/SessionCopyLink/SessionCopyLink.tsx +++ b/frontend/app/components/shared/SharePopup/SessionCopyLink/SessionCopyLink.tsx @@ -1,18 +1,20 @@ import React from 'react'; +import { connect } from 'react-redux'; import { Button, Icon } from 'UI'; import copy from 'copy-to-clipboard'; import { PlayerContext } from 'App/components/Session/playerContext'; import { observer } from 'mobx-react-lite'; +import { DateTime } from 'luxon'; -function SessionCopyLink() { +function SessionCopyLink({ startedAt }: any) { const [copied, setCopied] = React.useState(false); - const { store } = React.useContext(PlayerContext) - - const time = store.get().time + const { store } = React.useContext(PlayerContext); + const time = store.get().time; const copyHandler = () => { setCopied(true); - copy(window.location.origin + window.location.pathname + '?jumpto=' + Math.round(time)); + const timeStr = DateTime.fromMillis(startedAt + time); + copy(window.location.origin + window.location.pathname + '?jumpto=' + parseInt(String(timeStr.toMillis()))); setTimeout(() => { setCopied(false); }, 1000); @@ -31,4 +33,9 @@ function SessionCopyLink() { ); } -export default observer(SessionCopyLink); +export default connect((state: any) => { + return { + time: state.time, + startedAt: state.getIn(['sessions', 'current']).startedAt || 0, + }; +})(observer(SessionCopyLink));