Skip to content

Commit

Permalink
feat(videodetail): add playnext for series
Browse files Browse the repository at this point in the history
  • Loading branch information
royschut committed Jun 17, 2021
1 parent 7564a88 commit ec39437
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/screens/Series/Series.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ const Series = ({

const onCardClick = (item: PlaylistItem) => seriesPlaylist && history.push(episodeURL(seriesPlaylist, item.mediaid));

const playNext = () => {
if (!item || !seriesPlaylist) return;

const index = seriesPlaylist.playlist.findIndex(({ mediaid }) => mediaid === item.mediaid);
const nextItem = seriesPlaylist.playlist[index + 1];

return nextItem && history.push(episodeURL(seriesPlaylist, nextItem.mediaid, true));
};

const onShareClick = (): void => {
if (!item) return;

Expand Down Expand Up @@ -120,6 +129,7 @@ const Series = ({
play={play}
startPlay={startPlay}
goBack={goBack}
onComplete={() => playNext()}
poster={posterFading ? 'fading' : 'normal'}
enableSharing={enableSharing}
hasShared={hasShared}
Expand Down

0 comments on commit ec39437

Please sign in to comment.