Skip to content

Commit

Permalink
fix(incito): almost respect VideoView autoplay/controls/loop options (#…
Browse files Browse the repository at this point in the history
…268)

* conditional controls when not lazy

* refactor
  • Loading branch information
t-lansing authored Dec 6, 2024
1 parent b9a9fc6 commit 18152a9
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions lib/incito-browser/incito.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,25 +287,24 @@ function renderView(view, canLazyload: boolean, shouldLazyload: boolean) {

const src = String(new URL(view.src));

if (view.autoplay === true) {
attrs['data-autoplay'] = true;
}

if (view.controls === true) {
attrs['controls'] = '';
}

if (view.loop === true) {
attrs['loop'] = '';
}

if (canLazyload && shouldLazyload) {
attrs['data-src'] = `${src}#t=0.1`;
attrs['data-mime'] = view.mime;
classNames.push('incito--lazy');

if (view.autoplay === true) {
attrs['data-autoplay'] = true;
}

if (view.controls === true) {
attrs['controls'] = '';
}

if (view.loop === true) {
attrs['loop'] = '';
}
} else {
attrs.src = `${src}#t=0.1`;
attrs.controls = '';
}

break;
Expand Down

0 comments on commit 18152a9

Please sign in to comment.