mirror of
https://github.com/Microsoft/vscode
synced 2024-10-02 09:18:59 +00:00
feat: adding optional support for auto playing and looping videos (#184758)
* feat: adding options to support videos looping and auto playing Signed-off-by: Fawzi Abdulfattah <iifawzie@gmail.com> * chore: adding on mute to the videos auto play setting's description Signed-off-by: Fawzi Abdulfattah <iifawzie@gmail.com> --------- Signed-off-by: Fawzi Abdulfattah <iifawzie@gmail.com>
This commit is contained in:
parent
7c2d459318
commit
46e83a2613
|
@ -33,6 +33,9 @@
|
||||||
}
|
}
|
||||||
video.playsInline = true;
|
video.playsInline = true;
|
||||||
video.controls = true;
|
video.controls = true;
|
||||||
|
video.autoplay = settings.autoplay;
|
||||||
|
video.muted = settings.autoplay;
|
||||||
|
video.loop = settings.loop;
|
||||||
|
|
||||||
function onLoaded() {
|
function onLoaded() {
|
||||||
if (hasLoadedMedia) {
|
if (hasLoadedMedia) {
|
||||||
|
|
|
@ -27,6 +27,22 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"contributes": {
|
"contributes": {
|
||||||
|
"configuration": {
|
||||||
|
"type": "object",
|
||||||
|
"title": "Media Previewer",
|
||||||
|
"properties": {
|
||||||
|
"previewer.videos.autoPlay": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"markdownDescription": "%videoPreviewerAutoPlay%"
|
||||||
|
},
|
||||||
|
"previewer.videos.loop": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false,
|
||||||
|
"markdownDescription": "%videoPreviewerLoop%"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"customEditors": [
|
"customEditors": [
|
||||||
{
|
{
|
||||||
"viewType": "imagePreview.previewEditor",
|
"viewType": "imagePreview.previewEditor",
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
"customEditor.audioPreview.displayName": "Audio Preview",
|
"customEditor.audioPreview.displayName": "Audio Preview",
|
||||||
"customEditor.imagePreview.displayName": "Image Preview",
|
"customEditor.imagePreview.displayName": "Image Preview",
|
||||||
"customEditor.videoPreview.displayName": "Video Preview",
|
"customEditor.videoPreview.displayName": "Video Preview",
|
||||||
|
"videoPreviewerAutoPlay": "Start playing videos on mute automatically.",
|
||||||
|
"videoPreviewerLoop": "Loop videos over again automatically.",
|
||||||
"command.zoomIn": "Zoom in",
|
"command.zoomIn": "Zoom in",
|
||||||
"command.zoomOut": "Zoom out",
|
"command.zoomOut": "Zoom out",
|
||||||
"command.copyImage": "Copy"
|
"command.copyImage": "Copy"
|
||||||
|
|
|
@ -54,8 +54,11 @@ class VideoPreview extends MediaPreview {
|
||||||
|
|
||||||
protected async getWebviewContents(): Promise<string> {
|
protected async getWebviewContents(): Promise<string> {
|
||||||
const version = Date.now().toString();
|
const version = Date.now().toString();
|
||||||
|
const configurations = vscode.workspace.getConfiguration('previewer.videos');
|
||||||
const settings = {
|
const settings = {
|
||||||
src: await this.getResourcePath(this.webviewEditor, this.resource, version),
|
src: await this.getResourcePath(this.webviewEditor, this.resource, version),
|
||||||
|
autoplay: configurations.get('autoPlay'),
|
||||||
|
loop: configurations.get('loop'),
|
||||||
};
|
};
|
||||||
|
|
||||||
const nonce = getNonce();
|
const nonce = getNonce();
|
||||||
|
|
Loading…
Reference in a new issue