Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including penpencil-player with all npm packages installed. Try it out:

require("@angular/common/package.json"); // @angular/common is a peer dependency. require("@angular/core/package.json"); // @angular/core is a peer dependency. var penpencilPlayer = require("penpencil-player")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

penpencil-player v2.3.3

PenpencilPlayer is HTML5 video player based ob videjs library. It gathers all the neccessory plugins or library at single place to play videos like:- Vimeo, Youtube , hls (m3us). PenpencilPlayer require angular v6 or above.

PenpencilPlayer

npm version

PenpencilPlayer is based on videoJS library. You can install this via npm i penpencil-player

Description

PenpencilPlayer is HTML5 video player based on videoJS library. Basically, I build this player for my personal use, I just wanted a player which can play multiple video formats like: MP4, Youtube, HLS.

####Feature: i) Support Multiple video formats like: MP4, Youtube, HLS.

ii) Multiple video quality support for both HLS and MP4 sources.

iii) Dynamic watermarking including Text, Image and Link. (Combined or Individual)

iv) Forward and backward seek button compatibility.

v) Setting button with Quality and Speed options

v) Live video ui.

Note:- Because this library is only for personal use, I made lots of stuff hardcoded, like: Adding Plugins.

How to use

Step 1: Install the penpencil-player using npm i penpencil-player

Step 2: Paste these Styles and Script urls in your angular.json

"styles": [...
              "node_modules/video.js/dist/video-js.min.css"
              ]

"scripts": [...
              "node_modules/video.js/dist/video.min.js",
              "node_modules/@videojs/http-streaming/dist/videojs-http-streaming.min.js"
              ]

Step 3: Add PenpencilPalyerModule In AppModule

import: [..
  PenpencilPlayerModule
..
]

Step 4: Add PenpencilPlayer component in your html.

<rs-penpencil-player [playerConfig]="playerConfig"></rs-penpencil-player>

Step 5: Provide player config:

playerConfig = {
    poster: 'Poster Image Url',
    liveui: false,
    sources: [{
      src: 'Video source url',
      type: 'Video type' // video/mp4 (for mp4) ||application/x-mpegURL (for hls) || video/youtube (for youtube)
    }],
    autoplay: true,
    startTime: 0,
    fullScreenEnabled: false,
    fluid: boolean; // fluid || fill || responsive
    seekButtons: true, // Add plugin first
    seekSeconds: 2, // Add plugin first
    watermark: { // Add plugin first
      text: string, 
      link: string, 
      imageUrl: string
    }
 };
 
 Chnage listner is being detected on player config, 
 If you want to update player src try this.
 
 playerConfig = {...} // replace your new player config with new video source
 
 Currently supported video type
  1: video/mp4 (for mp4)
  2: video/youtube (for youtube)
  3: application/x-mpegURL (for hls)

Step 5: Adding Plugins:

Download all the plugins and unzip it and paste all the plugins in project directory

i) Setting button for video quality and speed settings videojs-setting-menu-plugin.

"styles": [...
              "videojs-setting-menu/videojs-setting-menu.css"
              ]

"scripts": [...
              "videojs-setting-menu/videojs-setting-menu.min.js"
              ]

ii) Seek button for forward and backward videojs-seek-buttons-plugin.

"styles": [...
              "videojs-seek-buttons/videojs-seek-buttons.css"
              ]

"scripts": [...
              "videojs-seek-buttons/videojs-seek-buttons.min.js"
              ]

iii) Youtube video support videojs-youtube-plugin.

"scripts": [...
              "videojs-youtube/videojs-youtube.min.js"
              ]

iv) Dynamic watermarking videojs-watermark-plugin.

"styles": [...
              "videojs-watermark/videojs-watermark.css"
              ]

"scripts": [...
              "videojs-watermark/videojs-watermark.js"
              ]

v) Video live ui support videojs-liveui-plugin.

"scripts": [...
              "videojs-liveui/videojs-liveui.min.js"
              ]

Credits (Using libraries and plugins)

videojs http-streaming videojs-hls-quality-selector videojs-contrib-quality-levels videojs-youtube videojs-seek-buttons

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free