streamroot / videojs-hlsjs-plugin

hls.js Source Handler for video.js 5
http://www.streamroot.io
MIT License
155 stars 80 forks source link

Trouble utilizing latest version #98

Open stevendesu opened 5 years ago

stevendesu commented 5 years ago

Previously I was using a fork of the videojs-hlsjs-plugin library in my project so I could update HLS.js and make a few tweaks to the code.

I noticed recently that subtitles weren't working (at all) for me, so I decided to try using the latest version of the plugin to see if maybe it's a bug that was fixed, or an incompatibility between my version of the plugin and my version of HLS.js.

At first I installed like so:

npm install --save videojs-hlsjs-plugin

This gave the warning:

npm WARN deprecated videojs-hlsjs-plugin@1.0.5: Deprecated in favor of @streamroot/videojs-hlsjs-plugin

So I tried out @streamroot/videojs-hlsjs-plugin:

npm uninstall --save videojs-hlsjs-plugin
npm install --save videojs-hlsjs-plugin

In my initialization code (I'm using Webpack for building, so ES6 imports work just fine) I originally had the following code, which was working with my fork:

import videojs from "video.js";
import hlsPlugin from "videojs-hlsjs-plugin";

hlsPlugin.register(videojs);

I updated videojs-hlsjs-plugin to @streamroot/videojs-hlsjs-plugin and my video failed to load, throwing the error:

TypeError: hlsPlugin.register is not a function

I tried using require instead of import per the README, but got the same error:

import videojs from "video.js";
const hlsPlugin = require("@streamroot/videojs-hlsjs-plugin");

hlsPlugin.register(videojs);

At this point I can't get version 1.0.13 of the plugin to work.

Unrelated to the lack of functioning, but related to my reason for forking: Could the package on NPM be updated to include the full source code of the plugin, instead of just a minified and compiled mess? When including the plugin via a <script> tag, yes, it makes sense to have the whole bundle combined like that. However I can do my own minification after the fact, and if the original source were made available in the package then Webpack could de-duplicate dependencies between my code and yours (for instance, in a few places where I register HLS.js event listeners, I have to import HLS.js to access constants like Hls.Events.MANIFEST_LOADED).

tri170391 commented 5 years ago

https://github.com/streamroot/videojs-hlsjs-plugin/pull/94

Probably caused by this, anyway since you forked anyway you can revert this change on your fork I guess.

About the full source code you can use NPM feature to add git dependency on a certain release tag or branch of any repo.

tri170391 commented 5 years ago

For some context our CI and delivery for this script is majorly as a web script and since umd export will not "activate" when client has amd on his page (require.js) it breaks our intended use case...