Skip to content

Commit

Permalink
feat(video): set subtitle language (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
KatvonRivia authored Mar 31, 2020
1 parent 4b24ddd commit b4ecfde
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions src/scripts/components/story-video/story-video.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
import React, {FunctionComponent} from 'react';
import {useSelector} from 'react-redux';

import {languageSelector} from '../../selectors/language';

import styles from './story-video.styl';

interface Props {
videoId: string;
}

const StoryVideo: FunctionComponent<Props> = ({videoId}) => (
<div className={styles.storyVideo}>
<iframe
width="100%"
height="100%"
src={`https://www.youtube.com/embed/${videoId}?rel=0&cc_load_policy=1`}
frameBorder="0"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen></iframe>
</div>
);
const StoryVideo: FunctionComponent<Props> = ({videoId}) => {
const language = useSelector(languageSelector);

return (
<div className={styles.storyVideo}>
<iframe
width="100%"
height="100%"
src={`https://www.youtube.com/embed/${videoId}?rel=0&cc_load_policy=1&cc_lang_pref=${language}`}
frameBorder="0"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen></iframe>
</div>
);
};

export default StoryVideo;

0 comments on commit b4ecfde

Please sign in to comment.