Novage / p2p-media-loader

An open-source engine for P2P streaming of live and on demand video directly in a web browser HTML page
https://novage.com.ua/p2p-media-loader/demo.html
Apache License 2.0
1.45k stars 314 forks source link

`p2pml` not found after upgrading to v1.0.1 #384

Closed wrfly closed 5 months ago

wrfly commented 5 months ago

I upgraded the lib to v1.0.1 recently but got error p2pml is not defined

image

mrlika commented 5 months ago

Hi @wrfly,

P2P Media Loader v1 features a new API. Please check the docs on how to use it: https://novage.github.io/p2p-media-loader/docs/latest

wrfly commented 5 months ago

Hi @mrlika ,

Thanks for your reply, I've checked the documents, and the <script type="module"> works fine.

But I'm facing issue with webpack. In the older versons, I just use:

import { Engine, initHlsJsPlayer } from 'p2p-media-loader-hlsjs';

but now when I import with

import { HlsJsP2PEngine } from 'p2p-media-loader-hlsjs';

the console reports error HlsJsP2PEngine not defined

in the js file compiled:

console.log(HlsJsP2PEngine);

was translated into

console.log(/* non-default import from non-esm module */undefined);
WARNING in ./src/ts/player.ts 3:12-26
export 'HlsJsP2PEngine' (imported as 'HlsJsP2PEngine') was not found in 'p2p-media-loader-hlsjs' (module has no exports)

WARNING in ./src/ts/player.ts 11:27-53
export 'HlsJsP2PEngine' (imported as 'HlsJsP2PEngine') was not found in 'p2p-media-loader-hlsjs' (module has no exports)

I'm new to javascript, apperaciate it if you could help, thanks!

mrlika commented 5 months ago

Thanks for reporting. We will test with Webpack on Monday. Can you specify more details what frameworks are you using.

Please check in our repository: we have a React demo. It uses Vite. And we bundle it into our Astro website without any issues.

wrfly commented 5 months ago

Thank you master!

wrfly commented 5 months ago

Hi master @mrlika , the CI failed https://github.com/Novage/p2p-media-loader/actions/runs/9746617636/job/26898569591 and the npm haven't been updated. Could you help to retry? thanks!

mrlika commented 5 months ago

Hi @wrfly, fixed. v1.0.2 released.