Added preview thumbnails setter & fixed cannot set property 'hover' of null (#2256)
* added iPad to isIos * elements.controls can be null * elements.controls can be null * added previewThumbnails setter * fixed readme formatting * previewThumbnails setter to method
This commit is contained in:
@ -841,7 +841,9 @@ class Listeners {
|
||||
.filter((c) => !c.contains(elements.container))
|
||||
.forEach((child) => {
|
||||
this.bind(child, 'mouseenter mouseleave', (event) => {
|
||||
elements.controls.hover = !player.touch && event.type === 'mouseenter';
|
||||
if (elements.controls) {
|
||||
elements.controls.hover = !player.touch && event.type === 'mouseenter';
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
10
src/js/plyr.d.ts
vendored
10
src/js/plyr.d.ts
vendored
@ -211,6 +211,11 @@ declare class Plyr {
|
||||
*/
|
||||
airplay(): void;
|
||||
|
||||
/**
|
||||
* Sets the preview thubmnails for the current source.
|
||||
*/
|
||||
setPreviewThumbnails(source: Plyr.PreviewThumbnailsOptions): void;
|
||||
|
||||
/**
|
||||
* Toggle the controls (video only). Takes optional truthy value to force it on/off.
|
||||
*/
|
||||
@ -619,6 +624,11 @@ declare namespace Plyr {
|
||||
* Booleans are converted to HTML5 value-less attributes.
|
||||
*/
|
||||
tracks?: Track[];
|
||||
|
||||
/**
|
||||
* Enable or disable preview thumbnails for current source
|
||||
*/
|
||||
previewThumbnails?: Plyr.PreviewThumbnailsOptions;
|
||||
}
|
||||
|
||||
interface Source {
|
||||
|
@ -1030,6 +1030,23 @@ class Plyr {
|
||||
return this.media === document.pictureInPictureElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the preview thubmnails for the current source
|
||||
*/
|
||||
setPreviewThumbnails(thumbnailSource) {
|
||||
if (this.previewThumbnails && this.previewThumbnails.loaded) {
|
||||
this.previewThumbnails.destroy();
|
||||
this.previewThumbnails = null;
|
||||
}
|
||||
|
||||
Object.assign(this.config.previewThumbnails, thumbnailSource);
|
||||
|
||||
// Create new instance if it is still enabled
|
||||
if (this.config.previewThumbnails.enabled) {
|
||||
this.previewThumbnails = new PreviewThumbnails(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger the airplay dialog
|
||||
* TODO: update player with state, support, enabled
|
||||
|
Reference in New Issue
Block a user