* add basic JS tooling
* fix accidental uses of global variables
* auto-format
* add and fix a couple more standard lint rules
* remove useless return false from settimeout callbacks
* document JS contributing
* fix whitespace in package.json
* add JS stuff to codespell skiplist
* codespell take two
* update github action and add comments about duplicated logic
@ -76,6 +76,10 @@ Do you see anything on the roadmap that you would like to take a closer look at
To fix a bug or implement a feature, fork the repository and make all changes to the testing branch. When ready, create a pull request.
## Making changes to the JavaScript
The JavaScript does not require any build step; you just edit the files directly. However, there is config for eslint and prettier (a linter and formatter respectively); their use is recommended but not required. To use them, install `node`, run `npm i` from the root directory of this repository to install dependencies, then run `npm run lint` and `npm run format` to run eslint and prettier respectively.
receiverApplicationId:chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,// Use built in receiver app on cast device, see https://developers.google.com/cast/docs/styled_receiver if you want to be able to add a theme, splash screen or watermark. Has a $5 one time fee.
mediaInfo=newchrome.cast.media.MediaInfo(contentId,contentType);// Create MediaInfo var that contains url and content type
letmediaInfo=newchrome.cast.media.MediaInfo(contentId,contentType);// Create MediaInfo var that contains url and content type
// mediaInfo.streamType = chrome.cast.media.StreamType.BUFFERED; // Set type of stream, BUFFERED, LIVE, OTHER
mediaInfo.metadata=newchrome.cast.media.GenericMediaMetadata();// Create metadata var and add it to MediaInfo
mediaInfo.metadata.title=contentTitle.replace("&","&");// Set the video title
mediaInfo.metadata.title=contentTitle.replace('&','&');// Set the video title
mediaInfo.metadata.images=[newchrome.cast.Image(contentImage)];// Set the video thumbnail
// mediaInfo.textTrackStyle = new chrome.cast.media.TextTrackStyle();
mediaInfo.tracks=contentSubtitles;
varrequest=newchrome.cast.media.LoadRequest(mediaInfo);// Create request with the previously set MediaInfo.
letrequest=newchrome.cast.media.LoadRequest(mediaInfo);// Create request with the previously set MediaInfo.
// request.queueData = new chrome.cast.media.QueueData(); // See https://developers.google.com/cast/docs/reference/web_sender/chrome.cast.media.QueueData for playlist support.
request.currentTime=shiftCurrentTime(contentCurrentTime);// Set video start position based on the browser video position
request.activeTrackIds=contentActiveSubtitle;// Set active subtitle based on video player
@ -117,18 +125,19 @@ function castStart() {
function(){
castSuccessful();
},
function(){
castFailed(errorCode);
function(error){
castFailed(error.code);
}
);// Send request to cast device
}
}
functionshiftCurrentTime(contentCurrentTime){// Shift media back 3 seconds to prevent missing some of the content
functionshiftCurrentTime(contentCurrentTime){
// Shift media back 3 seconds to prevent missing some of the content