1.0.3 • Published 1 year ago

@padhariyavishal/jw-player v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

JW Player

JW Player Component using typescript for react or react based frameworks.

Installation

To install the package, use npm:

npm install @padhariyavishal/jw-player

Usage

To use the JWPlayer Component in your React or Next.js project, follow these steps:

Example

Javascript based example:

import { JWPlayer } from "@padhariyavishal/jw-player";

const MyPlayer = () => {
    const playerConfig = {
        elementId: 'my-player',
        licenseKey: 'YOUR_LICENSE_KEY',
        playlist: [
            {
                file: 'https://example.com/path/to/your/video1.mp4',
                image: 'https://example.com/path/to/your/thumbnail1.jpg',
                title: 'Video 1',
                description: 'Description for Video 1'
            },
            {
                file: 'https://example.com/path/to/your/video2.mp4',
                image: 'https://example.com/path/to/your/thumbnail2.jpg',
                title: 'Video 2',
                description: 'Description for Video 2'
            }
        ],
        width: '640',
        height: '360'
    };

    return (
        <div>
            <h1>Welcome to My JW Player Page</h1>
            <JWPlayer {...playerConfig} />
        </div>
    );
};

export default MyPlayer;

TypeScript based example:

import { JWPlayer,JWPlayerConfig } from "@padhariyavishal/jw-player";

const MyPlayer: React.FC = () => {
    const playerConfig: JWPlayerConfig = {
        elementId: 'my-player',
        licenseKey: 'YOUR_LICENSE_KEY',
        playlist: [
            {
                file: 'https://example.com/path/to/your/video1.mp4',
                image: 'https://example.com/path/to/your/thumbnail1.jpg',
                title: 'Video 1',
                description: 'Description for Video 1'
            },
            {
                file: 'https://example.com/path/to/your/video2.mp4',
                image: 'https://example.com/path/to/your/thumbnail2.jpg',
                title: 'Video 2',
                description: 'Description for Video 2'
            }
        ],
        width: '640',
        height: '360'
    };

    return (
        <div>
            <h1>Welcome to My JW Player Page</h1>
            <JWPlayer {...playerConfig} />
        </div>
    );
};

export default MyPlayer;

Props

JWPlayerConfig

PropertyTypeDescription
elementIdstringThe ID of the DOM element where the player will be embedded.
licenseKeystringYour JW Player license key.
videoUrlstringThe URL of the video to play (if not using a playlist).
thumbnailUrlstringThe URL of the thumbnail image (if not using a playlist).
playlistArrayAn array of playlist items (each item should have file, image, title, and description).
widthstringThe width of the player (default is '640').
heightstringThe height of the player (default is '360').
titlestringThe title of the video (if not using a playlist).
descriptionstringThe description of the video (if not using a playlist).
autostartbooleanWhether to automatically start the video (default is false).
repeatbooleanWhether to repeat the video (default is false).
controlsbooleanWhether to show player controls (default is true).
mutebooleanWhether to mute the video (default is false).
advertisingobjectAdvertising configuration object.

PlaylistItem

PropertyTypeDescription
filestringThe URL of the video file.
imagestringThe URL of the thumbnail image.
titlestringThe title of the video.
descriptionstringThe description of the video.
1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago