During initialization you can configure your app
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
appDir |
string |
<optional> |
main directory path, can be any valid path, default is electronApp.getPath('userData') |
settingsName |
string |
<optional> |
name of the folder in main directory path where to store settings |
publicName |
string |
<optional> |
name of the folder in main directory path which will be served over http |
downloadsName |
string |
<optional> |
name of the folder in main directory path and publicName where to store assets |
offlineDomain |
string |
<optional> |
on which domain the content should be served, default is 127.0.0.1 |
offlineContentPortStart |
number |
<optional> |
on which port offline content should be served, default is 3010 |
maxOfflineContentPortRange |
number |
<optional> |
max range for offline port to on which content can be served It will try from {offlineContentPortStart} and if taken it will try next until it finds a free one |
numberOfManifestsInParallel |
number |
<optional> |
max number of manifest that can be downloaded at the same time, the rest will go into queue. Be reasonable here, as it might slow down your computer, default value is 2. With 10 and very larges manifests it might go to hundreds of chunks (50 files can be downloaded at the same time per manifest). Also the highger number doesn't mean it will downloads all movies faster. You should find here some balance. Seems like 2-3 manifests gives the best results, 1 manifest limitation might work better for slower computers. |
customManifestIdFolderRegex |
regex | string | regex to use to validate custom manifest id - bear in mind that this
need to be also a valid folder name. By default it matches any letter or number or unicode characters (regional characters) or "-" or "_" as a first character Then it may have any letter or number or unicode characters (regional characters) or space or any of the following characters: ,.;'[]{}!@#$%&*()-_=+ |
|
openingTagForInvalidCustomManifestIdCharacter |
string |
<optional> |
when customManifestId is being invalidated against customManifestIdFolderRegex it will raise the error and include the customManifestId with marked invalid characters this is the opening tag to be added before invalid character |
closingTagForInvalidCustomManifestIdCharacter |
string |
<optional> |
when customManifestId is being invalidated against customManifestIdFolderRegex it will raise the error and include the customManifestId with marked invalid characters this is the closing tag to be added after invalid character |
Example
//somewhere in the main process
const downstreamElectron = require('downstream-electron');
const userSettings = {
appDir: "/Users/admin/myApp",
settingsName: "settings",
publicName: "public",
downloadsName: "movies"
numberOfManifestsInParallel: 3
};
function createWindow() {
downstreamElectron.init(userSettings);
const win = new BrowserWindow({
width: 1200,
height: 700,
resizable: true,
webPreferences: {
plugins: true
}
});
win.loadURL('file://index.html');
win.webContents.openDevTools();
}
app.on('ready', createWindow);