Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

media-chrome

Package Overview
Dependencies
Maintainers
1
Versions
640
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

media-chrome - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

2

dist/index.js

@@ -1,2 +0,2 @@

(()=>{var Te={HTMLElement:function(){},customElements:{get:function(){},define:function(){},whenDefined:function(){}}},_e={createElement:function(){return{}}},H=typeof window=="undefined",n=H?Te:window,l=H?_e:window.document;function a(o,e){n.customElements.get(o)||(n.customElements.define(o,e),n[e.name]=e)}function B(o){return o.split("-").map(function(e,t){return(t?e[0].toUpperCase():e[0].toLowerCase())+e.slice(1).toLowerCase()}).join("")}function C(o,e=!1){return o.split("_").map(function(t,i){return(i||e?t[0].toUpperCase():t[0].toLowerCase())+t.slice(1).toLowerCase()}).join("")}var d={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest"},M=class extends n.HTMLElement{constructor(){super();this._mediaPaused=!1,this._mediaMuted=!1,this._mediaVolume=1,this._mediaVolumeLevel="high",this._mediaCurrentTime=0,this._mediaDuration=NaN,this._mediaIsFullscreen=!1,this._mediaIsPip=!1,this._mediaBuffered=null,this._mediaPreviewImage=null,this._mediaPreviewCoords=null,this._mediaPlaybackRate=1}static get observedAttributes(){return["media-controller","media-paused","media-muted","media-volume","media-volume-level","media-is-fullscreen","media-current-time","media-duration","media-buffered","media-preview-image","media-preview-coords","media-is-pip","media-playback-rate"].concat(super.observedAttributes||[])}dispatchMediaEvent(e,t){t=Object.assign({bubbles:!0,composed:!0},t);let i=new n.CustomEvent(e,t),s=(this[`on${e}`]&&this[`on${e}`](i))===!1;s||this.dispatchEvent(i)}attributeChangedCallback(e,t,i){let s=B(e);if(s=="media"){if(i===null){this.media=null;return}let h=l.querySelector(i);if(!h||!h.play)throw new Error("Supplied media attribute does not appear to match a media element.");this.media=h;return}if(s=="mediaController"){this[s]=l.getElementById(i);return}let r=i;typeof this[s]=="boolean"&&(r=!(i===null)),this[s]=r}get mediaController(){return this._mediaController||null}set mediaController(e){if(e===this._mediaController)return;this._mediaController&&this._mediaController.unassociateElement(this),e&&(this._mediaController=e,e.associateElement(this))}get mediaPaused(){return this._mediaPaused}set mediaPaused(e){e=!!e,this._mediaPaused=e;let t=this.getAttribute("media-paused")!==null;e!==t&&(e?this.setAttribute("media-paused","media-paused"):this.removeAttribute("media-paused")),this.mediaPausedSet&&this.mediaPausedSet(e)}get mediaMuted(){return this._mediaMuted}set mediaMuted(e){e=!!e,this._mediaMuted=e;let t=this.getAttribute("media-muted")!==null;e!==t&&(e?this.setAttribute("media-muted","media-muted"):this.removeAttribute("media-muted")),this.mediaMutedSet&&this.mediaMutedSet(e)}get mediaVolume(){return this._mediaVolume}set mediaVolume(e){e=parseFloat(e),this._mediaVolume=e;let t=parseFloat(this.getAttribute("media-volume"));t!==e&&this.setAttribute("media-volume",e),this.mediaVolumeSet&&this.mediaVolumeSet(e)}get mediaVolumeLevel(){return this._mediaVolumeLevel}set mediaVolumeLevel(e){e=e.toLowerCase(),["off","low","medium","high"].indexOf(e)===-1&&(e="high"),this._mediaVolumeLevel=e;let t=this.getAttribute("media-volume-level");e!==t&&this.setAttribute("media-volume-level",e),this.mediaVolumeLevelSet&&this.mediaVolumeLevelSet(e)}get mediaCurrentTime(){return this._mediaCurrentTime}set mediaCurrentTime(e){e=parseFloat(e),e||(e=0),this._mediaCurrentTime=e;let t=parseFloat(this.getAttribute("media-current-time"));t!==e&&this.setAttribute("media-current-time",e),this.mediaCurrentTimeSet&&this.mediaCurrentTimeSet(e)}get mediaDuration(){return this._mediaDuration}set mediaDuration(e){e=parseFloat(e),this._mediaDuration=e;let t=parseFloat(this.getAttribute("media-duration"));isNaN(t)?this.removeAttribute("media-duration"):t!==e&&this.setAttribute("media-duration",e),this.mediaDurationSet&&this.mediaDurationSet(e)}get mediaPlaybackRate(){return this._mediaPlaybackRate}set mediaPlaybackRate(e){e=parseFloat(e),this._mediaPlaybackRate=e;let t=parseFloat(this.getAttribute("media-playback-rate"));isNaN(t)?this.removeAttribute("media-playback-rate"):t!==e&&this.setAttribute("media-playback-rate",e),this.mediaPlaybackRateSet&&this.mediaPlaybackRateSet(e)}get mediaIsFullscreen(){return this._mediaIsFullscreen}set mediaIsFullscreen(e){e=!!e,this._mediaIsFullscreen=e;let t=this.getAttribute("media-is-fullscreen")!==null;e!==t&&(e?this.setAttribute("media-is-fullscreen","media-is-fullscreen"):this.removeAttribute("media-is-fullscreen")),this.mediaIsFullscreenSet&&this.mediaIsFullscreenSet(e)}get mediaIsPip(){return this._mediaIsPip}set mediaIsPip(e){e=!!e,this._mediaIsPip=e;let t=this.getAttribute("media-is-pip")!==null;e!==t&&(e?this.setAttribute("media-is-pip","media-is-pip"):this.removeAttribute("media-is-pip")),this.mediaIsPipSet&&this.mediaIsPipSet(e)}get mediaPreviewImage(){return this._mediaPreviewImage}set mediaPreviewImage(e){this._mediaPreviewImage=e;let t=this.getAttribute("media-preview-image");t!==e&&this.setAttribute("media-preview-image",e),this.mediaPreviewImageSet&&this.mediaPreviewImageSet(e)}get mediaPreviewCoords(){return this._mediaPreviewCoords}set mediaPreviewCoords(e){typeof e=="string"&&(e=e.split(",")),this._mediaPreviewCoords=e;let t=this.getAttribute("media-preview-coords");t!==e.join(",")&&this.setAttribute("media-preview-coords",e.join(",")),this.mediaPreviewCoordsSet&&this.mediaPreviewCoordsSet(e)}};a("media-chrome-html-element",M);var p=M,N=l.createElement("template");N.innerHTML=`
(()=>{var Te={HTMLElement:function(){},customElements:{get:function(){},define:function(){},whenDefined:function(){}}},_e={createElement:function(){return{}}},H=typeof window=="undefined"||typeof window.customElements=="undefined",n=H?Te:window,l=H?_e:window.document;function a(o,e){n.customElements.get(o)||(n.customElements.define(o,e),n[e.name]=e)}function B(o){return o.split("-").map(function(e,t){return(t?e[0].toUpperCase():e[0].toLowerCase())+e.slice(1).toLowerCase()}).join("")}function C(o,e=!1){return o.split("_").map(function(t,i){return(i||e?t[0].toUpperCase():t[0].toLowerCase())+t.slice(1).toLowerCase()}).join("")}var d={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest"},M=class extends n.HTMLElement{constructor(){super();this._mediaPaused=!1,this._mediaMuted=!1,this._mediaVolume=1,this._mediaVolumeLevel="high",this._mediaCurrentTime=0,this._mediaDuration=NaN,this._mediaIsFullscreen=!1,this._mediaIsPip=!1,this._mediaBuffered=null,this._mediaPreviewImage=null,this._mediaPreviewCoords=null,this._mediaPlaybackRate=1}static get observedAttributes(){return["media-controller","media-paused","media-muted","media-volume","media-volume-level","media-is-fullscreen","media-current-time","media-duration","media-buffered","media-preview-image","media-preview-coords","media-is-pip","media-playback-rate"].concat(super.observedAttributes||[])}dispatchMediaEvent(e,t){t=Object.assign({bubbles:!0,composed:!0},t);let i=new n.CustomEvent(e,t),s=(this[`on${e}`]&&this[`on${e}`](i))===!1;s||this.dispatchEvent(i)}attributeChangedCallback(e,t,i){let s=B(e);if(s=="media"){if(i===null){this.media=null;return}let h=l.querySelector(i);if(!h||!h.play)throw new Error("Supplied media attribute does not appear to match a media element.");this.media=h;return}if(s=="mediaController"){this[s]=l.getElementById(i);return}let r=i;typeof this[s]=="boolean"&&(r=!(i===null)),this[s]=r}get mediaController(){return this._mediaController||null}set mediaController(e){if(e===this._mediaController)return;this._mediaController&&this._mediaController.unassociateElement(this),e&&(this._mediaController=e,e.associateElement(this))}get mediaPaused(){return this._mediaPaused}set mediaPaused(e){e=!!e,this._mediaPaused=e;let t=this.getAttribute("media-paused")!==null;e!==t&&(e?this.setAttribute("media-paused","media-paused"):this.removeAttribute("media-paused")),this.mediaPausedSet&&this.mediaPausedSet(e)}get mediaMuted(){return this._mediaMuted}set mediaMuted(e){e=!!e,this._mediaMuted=e;let t=this.getAttribute("media-muted")!==null;e!==t&&(e?this.setAttribute("media-muted","media-muted"):this.removeAttribute("media-muted")),this.mediaMutedSet&&this.mediaMutedSet(e)}get mediaVolume(){return this._mediaVolume}set mediaVolume(e){e=parseFloat(e),this._mediaVolume=e;let t=parseFloat(this.getAttribute("media-volume"));t!==e&&this.setAttribute("media-volume",e),this.mediaVolumeSet&&this.mediaVolumeSet(e)}get mediaVolumeLevel(){return this._mediaVolumeLevel}set mediaVolumeLevel(e){e=e.toLowerCase(),["off","low","medium","high"].indexOf(e)===-1&&(e="high"),this._mediaVolumeLevel=e;let t=this.getAttribute("media-volume-level");e!==t&&this.setAttribute("media-volume-level",e),this.mediaVolumeLevelSet&&this.mediaVolumeLevelSet(e)}get mediaCurrentTime(){return this._mediaCurrentTime}set mediaCurrentTime(e){e=parseFloat(e),e||(e=0),this._mediaCurrentTime=e;let t=parseFloat(this.getAttribute("media-current-time"));t!==e&&this.setAttribute("media-current-time",e),this.mediaCurrentTimeSet&&this.mediaCurrentTimeSet(e)}get mediaDuration(){return this._mediaDuration}set mediaDuration(e){e=parseFloat(e),this._mediaDuration=e;let t=parseFloat(this.getAttribute("media-duration"));isNaN(t)?this.removeAttribute("media-duration"):t!==e&&this.setAttribute("media-duration",e),this.mediaDurationSet&&this.mediaDurationSet(e)}get mediaPlaybackRate(){return this._mediaPlaybackRate}set mediaPlaybackRate(e){e=parseFloat(e),this._mediaPlaybackRate=e;let t=parseFloat(this.getAttribute("media-playback-rate"));isNaN(t)?this.removeAttribute("media-playback-rate"):t!==e&&this.setAttribute("media-playback-rate",e),this.mediaPlaybackRateSet&&this.mediaPlaybackRateSet(e)}get mediaIsFullscreen(){return this._mediaIsFullscreen}set mediaIsFullscreen(e){e=!!e,this._mediaIsFullscreen=e;let t=this.getAttribute("media-is-fullscreen")!==null;e!==t&&(e?this.setAttribute("media-is-fullscreen","media-is-fullscreen"):this.removeAttribute("media-is-fullscreen")),this.mediaIsFullscreenSet&&this.mediaIsFullscreenSet(e)}get mediaIsPip(){return this._mediaIsPip}set mediaIsPip(e){e=!!e,this._mediaIsPip=e;let t=this.getAttribute("media-is-pip")!==null;e!==t&&(e?this.setAttribute("media-is-pip","media-is-pip"):this.removeAttribute("media-is-pip")),this.mediaIsPipSet&&this.mediaIsPipSet(e)}get mediaPreviewImage(){return this._mediaPreviewImage}set mediaPreviewImage(e){this._mediaPreviewImage=e;let t=this.getAttribute("media-preview-image");t!==e&&this.setAttribute("media-preview-image",e),this.mediaPreviewImageSet&&this.mediaPreviewImageSet(e)}get mediaPreviewCoords(){return this._mediaPreviewCoords}set mediaPreviewCoords(e){typeof e=="string"&&(e=e.split(",")),this._mediaPreviewCoords=e;let t=this.getAttribute("media-preview-coords");t!==e.join(",")&&this.setAttribute("media-preview-coords",e.join(",")),this.mediaPreviewCoordsSet&&this.mediaPreviewCoordsSet(e)}};a("media-chrome-html-element",M);var p=M,N=l.createElement("template");N.innerHTML=`
<style>

@@ -3,0 +3,0 @@ :host {

{
"name": "media-chrome",
"version": "0.1.0",
"version": "0.1.1",
"description": "Custom elements (web components) for making audio and video player controls that look great in your website or app.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -15,3 +15,3 @@ # `<media-chrome>`

```html
<script type="module" src="https://unpkg.com/media-chrome@0"></script>
<script type="module" src="https://unpkg.com/media-chrome@0.1"></script>

@@ -24,3 +24,3 @@ <media-controller>

>
<track label="thumbnails" default kind="metadata" src="https://image.mux.com/DS00Spx1CV902MCtPj5WknGlR102V5HFkDe/storyboard.vtt"></track>
<track label="thumbnails" default kind="metadata" src="https://image.mux.com/DS00Spx1CV902MCtPj5WknGlR102V5HFkDe/storyboard.vtt">
</video>

@@ -62,3 +62,3 @@ <media-control-bar>

```html
<script type="module" src="https://unpkg.com/media-chrome@0"></script>
<script type="module" src="https://unpkg.com/media-chrome@0.1"></script>
```

@@ -65,0 +65,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc