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

msc-any-pip

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

msc-any-pip

Imaging what if we can let anything Picture-in-Picture (not only <video />) ?! Here comes <msc-any-pip /> to let it dream comes true. <msc-any-pip /> apply Document Picture-in-Picture API to given elements have Picture-in-Picture feature.

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

msc-any-pip

Published on webcomponents.org DeepScan grade

Imaging what if we can let anything Picture-in-Picture (not only <video />) ?! Here comes <msc-any-pip /> to let it dream comes true. <msc-any-pip /> apply Document Picture-in-Picture API to given elements have Picture-in-Picture feature.

<msc-any-pip />

Basic Usage

<msc-any-pip /> is a web component. All we need to do is put the required script into your HTML document. Then follow <msc-any-pip />'s html structure and everything will be all set.

  • Required Script
<script
  type="module"
  src="https://your-domain/wc-msc-any-pip.js">        
</script>
  • Structure

Put <msc-any-pip /> into HTML document. It will have different functions and looks with attribute mutation.

<msc-any-pip>
  <script type="application/json">
    {
      "width": 450,
      "height": 300
    }
  </script>

  <!-- Put any HTML element you like -->
  <div class="element-i-like-to-have-pip">
    ...
    ...
    ...
  </div>
</msc-any-pip>

Otherwise, developers could also choose remoteconfig to fetch config for <msc-any-pip />.

<msc-any-pip
  remoteconfig="https://your-domain/api-path"
  ...
></msc-any-pip>

JavaScript Instantiation

<msc-any-pip /> could also use JavaScript to create DOM element. Here comes some examples.

<script type="module">
import { MscAnyPip } from 'https://your-domain/wc-msc-any-pip.js';

const template = document.querySelector('.my-template');

// use DOM api
const nodeA = document.createElement('msc-any-pip');
document.body.appendChild(nodeA);
nodeA.appendChild(template.content.cloneNode(true));

// new instance with Class
const nodeB = new MscAnyPip();
document.body.appendChild(nodeB);
nodeB.appendChild(template.content.cloneNode(true));
nodeB.width = 450;
nodeB.height = 300;

// new instance with Class & default config
const config = {
  width: 450,
  height: 300
};
const nodeC = new MscAnyPip(config);
document.body.appendChild(nodeC);
nodeC.appendChild(template.content.cloneNode(true));
</script>

Style Customization

Developers could apply styles to decorate <msc-any-pip />'s looking.

<style>
msc-any-pip {
  --msc-any-pip-piping-text: 'Playing in Picture-in-Picture.';
  --msc-any-pip-piping-color: #39e75f;
  --msc-any-pip-piping-font-size: 16px;
}
</style>

Attributes

<msc-any-pip /> supports some attributes to let it become more convenience & useful.

  • width

Set Picture-in-Picture window width. Default is <msc-any-pip />'s clientWidth. (Picture-in-Picture's min window width is 300)

<msc-any-pip width="450">
  ...
</msc-any-pip>
  • height

Set Picture-in-Picture window height. Default is <msc-any-pip />'s clientHeight. (Picture-in-Picture's min window height is 300)

<msc-any-pip height="300">
  ...
</msc-any-pip>

Properties

Property NameTypeDescription
widthNumberGetter / Setter for Picture-in-Picture window width. Default is <msc-any-pip />'s clientWidth.
heightNumberGetter / Setter for Picture-in-Picture window height. Default is <msc-any-pip />'s clientHeight.

Events

Event SignatureDescription
msc-any-pip-pipingFired when user press confirm.
msc-any-pip-pip-endFired when Picture-in-Picture end.

Reference

Keywords

FAQs

Package last updated on 03 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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