To generate a video component using JavaScript, you can use the following code snippet. Keep in mind that the video element will not be displayed on the webpage.
var video = document.createElement('video');
var player = new shaka.Player(video);
var storage = new shaka.offline.Storage(player);
Currently, the shaka Player must operate within a webpage and cannot be loaded in a service worker. It is uncertain how electron will manage a background process, but it is likely to encounter issues because the player relies on specific APIs that are not accessible in service workers.
The Shaka team is actively modifying the APIs to allow for: (1) initializing a Player instance without a video element initially, and (2) creating a Storage instance without a Player instance. These adjustments are necessary to use the player within a service worker environment.