Skip to content

Commit

Permalink
Update dependencies (#418)
Browse files Browse the repository at this point in the history
* Update dependencies

* Fix linter issues

* Update documentation version

* Improve memory limits
  • Loading branch information
mrlika authored Sep 26, 2024
1 parent 0f9b117 commit db830f1
Show file tree
Hide file tree
Showing 13 changed files with 1,012 additions and 848 deletions.
2 changes: 1 addition & 1 deletion FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ const hls = new HlsWithP2P({

## How to see that P2P is actually working?

The easiest way is to subscribe to P2P [events](https://novage.github.io/p2p-media-loader/docs/v1.0/types/p2p_media_loader_core.CoreEventMap.html) and log them:
The easiest way is to subscribe to P2P [events](https://novage.github.io/p2p-media-loader/docs/v2.0/types/p2p_media_loader_core.CoreEventMap.html) and log them:

```javascript
const engine = new HlsJsP2PEngine();
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This library enables the creation of a huge P2P mesh networks, also known as pee

## Documentation and important links

- [API documentation](https://novage.github.io/p2p-media-loader/docs/latest/)
- [API documentation](https://novage.github.io/p2p-media-loader/docs/v2.0/)
- [P2P development, support & consulting](https://novage.com.ua/)
- [Demo](http://novage.com.ua/p2p-media-loader/demo.html)
- [FAQ](https://github.com/Novage/p2p-media-loader/blob/main/FAQ.md)
Expand Down
6 changes: 3 additions & 3 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
"react-dom": "^18.3.1"
},
"devDependencies": {
"@types/react": "^18.3.3",
"@types/react": "^18.3.9",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-react": "^7.36.1",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.9",
"eslint-plugin-react-refresh": "^0.4.12",
"vite-plugin-node-polyfills": "^0.22.0"
}
}
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
"create-doc": "pnpm typedoc"
},
"devDependencies": {
"eslint": "^8.57.0",
"eslint-plugin-import": "^2.29.1",
"eslint": "^8.57.1",
"eslint-plugin-import": "^2.30.0",
"prettier": "^3.3.3",
"rimraf": "^6.0.1",
"typedoc": "^0.26.5",
"typedoc": "^0.26.7",
"typedoc-material-theme": "^1.1.0",
"typescript": "^5.5.4",
"typescript-eslint": "^8.1.0",
"vite": "^5.4.0"
"typescript": "^5.6.2",
"typescript-eslint": "^8.7.0",
"vite": "^5.4.8"
}
}
4 changes: 2 additions & 2 deletions packages/p2p-media-loader-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@
"dependencies": {
"@types/debug": "^4.1.12",
"bittorrent-tracker": "^11.1.2",
"debug": "^4.3.6",
"debug": "^4.3.7",
"nano-md5": "^1.0.5"
},
"devDependencies": {
"@rollup/plugin-terser": "^0.4.4",
"@types/streamx": "^2.9.5",
"vite-plugin-node-polyfills": "^0.22.0",
"vitest": "^2.0.5"
"vitest": "^2.1.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const BYTES_PER_MiB = 1048576;

export class SegmentMemoryStorage implements SegmentStorage {
private readonly userAgent = navigator.userAgent;
private segmentMemoryStorageLimit = 4000;
private segmentMemoryStorageLimit = 4 * 1024;
private currentMemoryStorageSize = 0;

private cache = new Map<string, SegmentDataItem>();
Expand Down Expand Up @@ -265,9 +265,9 @@ export class SegmentMemoryStorage implements SegmentStorage {
}

if (isAndroidWebview(this.userAgent) || isIPadOrIPhone(this.userAgent)) {
this.segmentMemoryStorageLimit = 1000;
this.segmentMemoryStorageLimit = 1024;
} else if (isAndroid(this.userAgent)) {
this.segmentMemoryStorageLimit = 2000;
this.segmentMemoryStorageLimit = 2 * 1024;
}
}

Expand Down
10 changes: 5 additions & 5 deletions packages/p2p-media-loader-core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ export type CommonCoreConfig = {
* ```
*
* - When `undefined`, the default limit is determined based on the device type and browser:
* - Desktop: 4000 MiB
* - Android: 2000 MiB
* - iOS: 1000 MiB
* - Android WebView: 1000 MiB
* - iOS WebView: 1000 MiB
* - Desktop: 4096 MiB
* - Android: 2048 MiB
* - iOS: 1024 MiB
* - Android WebView: 1024 MiB
* - iOS WebView: 1024 MiB
*
*/
segmentMemoryStorageLimit: number | undefined;
Expand Down
14 changes: 7 additions & 7 deletions packages/p2p-media-loader-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,27 @@
"clean-with-modules": "rimraf node_modules && pnpm clean"
},
"dependencies": {
"@vidstack/react": "^1.11.24",
"@vidstack/react": "^1.12.11",
"d3": "^7.9.0",
"dplayer": "^1.27.1",
"hls.js": "^1.5.14",
"hls.js": "^1.5.15",
"mediaelement": "^7.0.5",
"openplayerjs": "^2.14.4",
"openplayerjs": "^2.14.5",
"p2p-media-loader-core": "workspace:*",
"p2p-media-loader-hlsjs": "workspace:*",
"p2p-media-loader-shaka": "workspace:*",
"plyr": "^3.7.8",
"shaka-player": "^4.10.9"
"shaka-player": "^4.11.6"
},
"devDependencies": {
"@types/d3": "^7.4.3",
"@types/dplayer": "^1.25.5",
"@types/react": "^18.3.3",
"@types/react": "^18.3.9",
"@types/react-dom": "^18.3.0",
"cpy-cli": "^5.0.0",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-react": "^7.36.1",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.9",
"eslint-plugin-react-refresh": "^0.4.12",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/p2p-media-loader-hlsjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@
},
"devDependencies": {
"@rollup/plugin-terser": "^0.4.4",
"hls.js": "^1.5.14"
"hls.js": "^1.5.15"
}
}
2 changes: 1 addition & 1 deletion packages/p2p-media-loader-shaka/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@
},
"devDependencies": {
"@rollup/plugin-terser": "^0.4.4",
"shaka-player": "^4.10.9"
"shaka-player": "^4.11.6"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export class ManifestParserDecorator implements shaka.extern.ManifestParser {

// For version 4.2; Retrieving mediaSequence map for each HLS playlist
const manifestVariantsMap = maps.find((map) => {
const item = map.values().next().value as unknown;
const item = map.values().next().value;

return (
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
Expand All @@ -237,8 +237,7 @@ export class ManifestParserDecorator implements shaka.extern.ManifestParser {
const mediaSequenceTimeMap = getMapPropertiesFromObject(
variant as Record<string, unknown>,
).find((map) => {
const [key, value] =
(map.entries().next().value as [unknown, unknown] | undefined) ?? [];
const [key, value] = map.entries().next().value ?? [];
return typeof key === "number" && typeof value === "number";
});

Expand Down
6 changes: 2 additions & 4 deletions packages/p2p-media-loader-shaka/src/stream-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,12 @@ export function getSegmentInfoFromReference(
};
}

export function getStreamLastMediaSequence(
stream: StreamWithReadonlySegments,
): number | undefined {
export function getStreamLastMediaSequence(stream: StreamWithReadonlySegments) {
const { shakaStream } = stream;
const map = shakaStream.mediaSequenceTimeMap;
if (!map) return;

const firstMediaSequence = map.keys().next().value as number | undefined;
const firstMediaSequence = map.keys().next().value;
if (firstMediaSequence === undefined) return;
return firstMediaSequence + map.size - 1;
}
Loading

0 comments on commit db830f1

Please sign in to comment.