save to offline without creating player object using shaka player

478 views Asked by At
Class: shaka.offline.Storage

have a constructor

new Storage(player)

Class: shaka.Player

have a constructor

new Player(video(non-null), opt_dependencyInjector(opt))

but what i trying to do is saving a video url without having a video element in page. Is it possible to do.

It would be nice if i could do this in a background on the main process of electron application.

1

There are 1 answers

4
ModMaker On

You can create a video element using JavaScript. It won't appear on the page.

var video = document.createElement('video');
var player = new shaka.Player(video);
var storage = new shaka.offline.Storage(player);

Currently, the player require being run inside a page. This means you can't load Shaka Player in a service worker. I'm not sure how electron will handle a background process, but it will likely not work because the player requires certain APIs to be available that are not available in service workers.

We (the Shaka team) are also currently working on changing the APIs so that: (1) you can initialize a Player instance initially without a video element, and (2) you can create a Storage instance without a Player instance. These are requirements to be able to use the player in a service worker.