removing unused import
This commit is contained in:
parent
5be2a88bc2
commit
920f0f85f4
5 changed files with 52 additions and 52 deletions
|
|
@ -8,7 +8,7 @@
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import controlsDocs from './stories/docs/controls.md?raw';
|
import controlsDocs from './stories/docs/controls.md?raw';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import withSoundDocs from './stories/docs/withSound.md?raw';
|
// import withSoundDocs from './stories/docs/withSound.md?raw';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import SilentVideo from './stories/videos/silent-video.mp4';
|
import SilentVideo from './stories/videos/silent-video.mp4';
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
import {
|
import {
|
||||||
withComponentDocs,
|
withComponentDocs,
|
||||||
withStoryDocs
|
withStoryDocs,
|
||||||
} from '$lib/docs/utils/withParams.js';
|
} from '$lib/docs/utils/withParams.js';
|
||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
|
|
@ -35,39 +35,38 @@
|
||||||
<Video {...args} />
|
<Video {...args} />
|
||||||
</Template>
|
</Template>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<Story
|
<Story
|
||||||
name="Default"
|
name="Default"
|
||||||
args={{
|
args="{{
|
||||||
ariaDescription: "Compulsory description of your video for screen readers.",
|
ariaDescription: 'Compulsory description of your video for screen readers.',
|
||||||
src: SilentVideo,
|
src: SilentVideo,
|
||||||
width: 'wide',
|
width: 'wide',
|
||||||
caption: 'Optional caption for your video.',
|
caption: 'Optional caption for your video.',
|
||||||
}}
|
}}"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Story
|
<Story
|
||||||
name="Playing and looping"
|
name="Playing and looping"
|
||||||
args={{
|
args="{{
|
||||||
ariaDescription: "Compulsory description of your video for screen readers.",
|
ariaDescription: 'Compulsory description of your video for screen readers.',
|
||||||
src: SilentVideo,
|
src: SilentVideo,
|
||||||
width: 'normal',
|
width: 'normal',
|
||||||
loopVideo: true,
|
loopVideo: true,
|
||||||
caption: 'World\'s longest glass bridge opens to public in Vietnam. (c) 2022 Thomson Reuters',
|
caption:
|
||||||
|
"World's longest glass bridge opens to public in Vietnam. (c) 2022 Thomson Reuters",
|
||||||
playVideoThreshold: 0.9,
|
playVideoThreshold: 0.9,
|
||||||
}}
|
}}"
|
||||||
{...withStoryDocs(playAndLoopDocs)}
|
{...withStoryDocs(playAndLoopDocs)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Story
|
<Story
|
||||||
name="Controls"
|
name="Controls"
|
||||||
args={{
|
args="{{
|
||||||
ariaDescription: "Compulsory description of your video for screen readers.",
|
ariaDescription: 'Compulsory description of your video for screen readers.',
|
||||||
src: SilentVideo,
|
src: SilentVideo,
|
||||||
width: 'normal',
|
width: 'normal',
|
||||||
caption: 'World\'s longest glass bridge opens to public in Vietnam. (c) 2022 Thomson Reuters',
|
caption:
|
||||||
|
"World's longest glass bridge opens to public in Vietnam. (c) 2022 Thomson Reuters",
|
||||||
playVideoThreshold: 0.9,
|
playVideoThreshold: 0.9,
|
||||||
controlsColour: 'white',
|
controlsColour: 'white',
|
||||||
controlsOpacity: 1,
|
controlsOpacity: 1,
|
||||||
|
|
@ -75,23 +74,24 @@
|
||||||
separateReplayIcon: true,
|
separateReplayIcon: true,
|
||||||
loopVideo: false,
|
loopVideo: false,
|
||||||
hoverToSeeControls: true,
|
hoverToSeeControls: true,
|
||||||
}}
|
}}"
|
||||||
{...withStoryDocs(controlsDocs)}
|
{...withStoryDocs(controlsDocs)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Story
|
<Story
|
||||||
name="Videos with sound"
|
name="Videos with sound"
|
||||||
args={{
|
args="{{
|
||||||
ariaDescription: "Compulsory description of your video for screen readers.",
|
ariaDescription: 'Compulsory description of your video for screen readers.',
|
||||||
src: SoundVideo,
|
src: SoundVideo,
|
||||||
width: 'normal',
|
width: 'normal',
|
||||||
caption: 'World\'s longest glass bridge opens to public in Vietnam. (c) 2022 Thomson Reuters',
|
caption:
|
||||||
|
"World's longest glass bridge opens to public in Vietnam. (c) 2022 Thomson Reuters",
|
||||||
playVideoThreshold: 0.9,
|
playVideoThreshold: 0.9,
|
||||||
showControls: true,
|
showControls: true,
|
||||||
loopVideo: false,
|
loopVideo: false,
|
||||||
muteVideo: false,
|
muteVideo: false,
|
||||||
playVideoWhenInView: true,
|
playVideoWhenInView: true,
|
||||||
allowSoundToAutoplay: true,
|
allowSoundToAutoplay: true,
|
||||||
}}
|
}}"
|
||||||
{...withStoryDocs(controlsDocs)}
|
{...withStoryDocs(controlsDocs)}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@ General-purpose video component. Can play on load or when the video comes into v
|
||||||
import { assets } from '$app/paths'; // If using local video in the Graphics Kit
|
import { assets } from '$app/paths'; // If using local video in the Graphics Kit
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Video
|
<Video
|
||||||
ariaDescription={"Compulsory description of your video for screen readers."}
|
ariaDescription="{'Compulsory description of your video for screen readers.'}"
|
||||||
src={`${assets}/videos/myVideo.mp4`}
|
src="{`${assets}/videos/myVideo.mp4`}"
|
||||||
size={'wide'}
|
width="{'wide'}"
|
||||||
caption={'Optional caption for your video.'}
|
caption="{'Optional caption for your video.'}"
|
||||||
/>
|
/>
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
`showControls`
|
`showControls`
|
||||||
|
|
||||||
- By default, the video has a play/pause button, which corresponds to
|
- By default, the video has a play/pause button, which corresponds to
|
||||||
`showControls={true}`. If you don't want these, just set `showControls={false}`.
|
`showControls={true}`. If you don't want these, just set `showControls={false}`.
|
||||||
When you do that, the icons themselves will disappear but the functionality of playing and pausing remains and can be done by clicking on the video itself.
|
When you do that, the icons themselves will disappear but the functionality of playing and pausing remains and can be done by clicking on the video itself.
|
||||||
If you don't want to enable any play/pause functionality, add `possibleToPlayPause={false}`.
|
If you don't want to enable any play/pause functionality, add `possibleToPlayPause={false}`.
|
||||||
- If you want to show the controls only when the video is hovered, set `hoverToSeeControls={true}`.
|
- If you want to show the controls only when the video is hovered, set `hoverToSeeControls={true}`.
|
||||||
|
|
||||||
`controlsColour`, `controlsOpacity`, `controlsPosition`, `separateReplayIcon`
|
`controlsColour`, `controlsOpacity`, `controlsPosition`, `separateReplayIcon`
|
||||||
|
|
||||||
If you do want to leave the controls, you have a couple of options to style them:
|
If you do want to leave the controls, you have a couple of options to style them:
|
||||||
|
|
||||||
|
|
@ -22,17 +22,17 @@ Here is an example with bottom right corner white opaque controls, with a replay
|
||||||
import { Video } from '@reuters-graphics/graphics-components';
|
import { Video } from '@reuters-graphics/graphics-components';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Video
|
<Video
|
||||||
ariaDescription={"Compulsory description of your video for screen readers."}
|
ariaDescription="{'Compulsory description of your video for screen readers.'}"
|
||||||
src={'path-to-video-or-external-url'}
|
src="{'path-to-video-or-external-url'}"
|
||||||
size={'normal'}
|
width="{'normal'}"
|
||||||
caption={'Optional caption for your video.'}
|
caption="{'Optional caption for your video.'}"
|
||||||
playVideoThreshold={0.1}
|
playVideoThreshold="{0.1}"
|
||||||
controlsColour={'white'}
|
controlsColour="{'white'}"
|
||||||
controlsOpacity={1}
|
controlsOpacity="{1}"
|
||||||
controlsPosition={'bottom right'}
|
controlsPosition="{'bottom right'}"
|
||||||
separateReplayIcon={true}
|
separateReplayIcon="{true}"
|
||||||
loopVideo={false}
|
loopVideo="{false}"
|
||||||
hoverToSeeControls={true}
|
hoverToSeeControls="{true}"
|
||||||
/>
|
/>
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
`playVideoWhenInView`, `playVideoThreshold`
|
`playVideoWhenInView`, `playVideoThreshold`
|
||||||
|
|
||||||
- By default, the video will **start playing when 50% of the video element's height is visible on the page**.
|
- By default, the video will **start playing when 50% of the video element's height is visible on the page**.
|
||||||
To control the threshold of visibility at which the video starts playing, add the prop `playVideoThreshold` and set it to a value between 0 and 1,
|
To control the threshold of visibility at which the video starts playing, add the prop `playVideoThreshold` and set it to a value between 0 and 1,
|
||||||
where 0 means that the video will start playing as soon as its top enters the viewport, while 1 means it will start when the whole video is in the viewport.
|
where 0 means that the video will start playing as soon as its top enters the viewport, while 1 means it will start when the whole video is in the viewport.
|
||||||
|
|
||||||
- If you don't want the video to play when you scroll to it, but **on page load**, add the prop `playVideoWhenInView={false}`. The default of the prop is `true`,
|
- If you don't want the video to play when you scroll to it, but **on page load**, add the prop `playVideoWhenInView={false}`. The default of the prop is `true`,
|
||||||
which corresponds to the behaviour described above.
|
which corresponds to the behaviour described above.
|
||||||
|
|
||||||
`loopVideo`
|
`loopVideo`
|
||||||
|
|
||||||
|
|
@ -18,11 +18,11 @@ Here is an example of what the same video would look like with a visibility thre
|
||||||
import { Video } from '@reuters-graphics/graphics-components';
|
import { Video } from '@reuters-graphics/graphics-components';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Video
|
<Video
|
||||||
ariaDescription={"Compulsory description of your video for screen readers."}
|
ariaDescription="{'Compulsory description of your video for screen readers.'}"
|
||||||
src={'path-to-video-or-external-url'}
|
src="{'path-to-video-or-external-url'}"
|
||||||
size={'normal'}
|
width="{'normal'}"
|
||||||
loopVideo={false}
|
loopVideo="{false}"
|
||||||
playVideoThreshold={0.9}
|
playVideoThreshold="{0.9}"
|
||||||
/>
|
/>
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ and go to the top. Click anywhere on the page before scrolling down to the video
|
||||||
<Video
|
<Video
|
||||||
ariaDescription="{'Compulsory description of your video for screen readers.'}"
|
ariaDescription="{'Compulsory description of your video for screen readers.'}"
|
||||||
src="{'path-to-video-or-external-url'}"
|
src="{'path-to-video-or-external-url'}"
|
||||||
size="{'normal'}"
|
width="{'normal'}"
|
||||||
controlsOpacity="{1}"
|
controlsOpacity="{1}"
|
||||||
loopVideo="{false}"
|
loopVideo="{false}"
|
||||||
muteVideo="{false}"
|
muteVideo="{false}"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue