Skip to content

Commit

Permalink
Update package version and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
fgervasi committed Aug 5, 2024
1 parent 6b2206f commit 2ca14b0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ScrollyVideo.js

A component for scroll-based (or other externally controlled) playback. See [`/demos`](https://github.com/dkaoster/scrolly-video/tree/main/demos) for full example usages.
This video scroller based on [video scroller of dkaoster](https://github.com/dkaoster/scrolly-video). This is a fork of the original project, with some modifications and improvements.

## 🚀 Web

Expand All @@ -16,8 +16,8 @@ Require javascript in your page and create the object (before `</body>`):
<script src="https://cdn.jsdelivr.net/npm/scrolly-video@latest/dist/scrolly-video.js"></script>
<script type="text/javascript">
new ScrollyVideo({
scrollyVideoContainer: "scrolly-video",
src: "https://scrollyvideo.js.org/goldengate.mp4"
scrollyVideoContainer: 'scrolly-video',
src: 'https://scrollyvideo.js.org/goldengate.mp4',
});
</script>
```
Expand All @@ -31,7 +31,7 @@ Import component in your application:

```javascript
import ScrollyVideo from 'scrolly-video/dist/ScrollyVideo.cjs.jsx';
or
or;
import ScrollyVideo from 'scrolly-video/dist/ScrollyVideo.esm.jsx';
```

Expand Down Expand Up @@ -74,12 +74,12 @@ Add html code to your html component:
## 🧰 Options / Attributes

| Parameter | Description | Values | Default |
|:----------------------|:---------------------------------------------------------------------------------------------------------|:-----------------|:--------|
| :-------------------- | :------------------------------------------------------------------------------------------------------- | :--------------- | :------ |
| src | The URL of the video (required) | URL | |
| scrollyVideoContainer | The DOM element of the container, only used for plain js | String / Element | |
| transitionSpeed | Sets the maximum playbackRate for this video | Number | 8 |
| frameThreshold | When to stop the video animation, in seconds | Number | 0.1 |
| cover | Forces the video to cover in it's container | Boolean | true |
| contain | Forces the video to cover in it's container | cover, contain | cover |
| sticky | Whether the video should have `position: sticky` | Boolean | true |
| full | Whether the video should take up the entire viewport | Boolean | true |
| trackScroll | Whether this object should automatically respond to scroll | Boolean | true |
Expand All @@ -90,19 +90,18 @@ Add html code to your html component:
| onChange | The callback for video percentage change | VoidFunction | |
| debug | Whether to log debug information | Boolean | false |


## Additional callbacks

***setVideoPercentage***
**_setVideoPercentage_**

Description: A way to set currentTime manually. Pass a progress in between of 0 and 1 that specifies the percentage position of the video. If `trackScroll` enabled - it performs scroll automatically.

Signature: `(percentage: number, options: { transitionSpeed: number, (progress: number) => number }) => void`

Example: `scrollyVideo.setVideoPercentage(0.5, { transitionSpeed: 12, easing: d3.easeLinear })`


## Technical Details and Cross Browser Differences

To make this library perform optimally in all browsers, three different approaches are taken to animating the video.

### Method 1: WebCodecs and Canvas
Expand All @@ -122,6 +121,7 @@ Thus, if the video needs to be animated backwards, this library falls back to me
This method is the way that scrollytelling videos have traditionally been done, using an HTML `<video>` tag and skipping directly to frames using currentTime. However, this method requires the video to be encoded at keyframe = 1, which causes the video to be a lot larger or the quality to drop. Unfortunately, this is the only option for scenarios where methods 1 and 2 are not supported, or on mobile safari browsers where somehow this method performs better than method 2. Thus, to achieve maximum performance under all circumstances, it is still recommended to encode videos with keyframe = 1, if possible.

## Known Issues

- On iOS, ScrollyVideo will not work if battery saver mode is on. Unfortunately, there is no workaround for this due to the way that iOS handles videos and battery saving functions.

---
Expand Down
14 changes: 6 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scrolly-video",
"version": "0.0.24",
"name": "@nzz/et-video-scroller",
"version": "0.1.0",
"description": "A component for scroll-based (or other externally controlled) playback.",
"main": "dist/scrolly-video.js",
"types": "dist/ScrollyVideo.d.ts",
Expand All @@ -17,7 +17,10 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/dkaoster/scrolly-video.git"
"url": "git+https://github.com/nzzdev/ed-tech-scrolly-video.git"
},
"publishConfig": {
"access": "public"
},
"keywords": [
"scroll",
Expand All @@ -27,12 +30,7 @@
"react",
"vue"
],
"author": "Daniel Kao",
"license": "MIT",
"bugs": {
"url": "https://github.com/dkaoster/scrolly-video/issues"
},
"homepage": "https://github.com/dkaoster/scrolly-video#readme",
"dependencies": {
"mp4box": "^0.4.9",
"ua-parser-js": "^1.0.2"
Expand Down

0 comments on commit 2ca14b0

Please sign in to comment.