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

mirax-player

Package Overview
Dependencies
Maintainers
1
Versions
144
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mirax-player

Mirax Player is a free video player for React, Vue, Angular, and Svelte that can embed videos from platforms like TikTok, YouTube/Shorts, Twitter, Vimeo and Dailymotion.

  • 6.3.1-alpha.1
  • next
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
154
increased by431.03%
Maintainers
1
Weekly downloads
 
Created
Source

Logo

Mirax Player

npm version Written Written Downloads License


Table of Contents

Description

Mirax Player is a free video player for React, Vue, Angular, and Svelte that can embed videos from platforms like TikTok, YouTube/Shorts, Twitter, Vimeo and Dailymotion. This library package enables you to set any URL once within a single embed code tag and dynamically embed videos from any video sites.

Frameworks / LibraryTested versions
React18 & above
Vue.js3 & above
Angular16 & above
Svelte3 & above

Release-notes

Version 6

Major changes:

  • Mirax tags become Mirax props."
  • useRef, ref, and element are based on HTMLDivElement, which has been removed."
  • The class names for the player and embed are more aligned with naming conventions."
  • The destructuring syntax becomes straightforward for named exports like { embed } and { player }.

Minor changes:

6.3.0

  • The shortcut key for playing videos will be Ctrl + Space for video player

6.2.0

  • Revised data-mirax-embed to data-e-."

Patch changes:

6.3.1

  • Fixed the player UI issue.

  • Progress bar move to the top


Features

  • This video player supports both TypeScript and JavaScript, making it developer-friendly.
  • Easy to use and responsive.
  • Can embed videos like TikTok, YouTube, YouTube Shorts, Twitter, Vimeo and Dailymotion.
  • Capable of playing videos (Portrait or Landscape).
  • Customizable color themes.
  • Supports PIP (Picture-in-Picture).

Installation

To install the Mirax Player, you can use the following npm command:

npm install mirax-player

Supported-sites

LogoSitesSource typeDocs.
YouTubeYouTube / ShortsIframe Apihttps://developers.google.com/youtube/iframe_api_reference
VimeoVimeoPlayer SDKhttps://developer.vimeo.com/player/sdk
TikTokTikTokoEmbed APIhttps://developers.tiktok.com/doc/embed-videos/
DailymotionDailymotionoEmbed APIhttps://developers.dailymotion.com/player/#player-oembed
TwitterTwitter / XJavaScript APIhttps://developer.twitter.com/en/docs/twitter-for-websites/javascript-api/guides/set-up-twitter-for-websites

Embed-video

Mirax embed propsFunctionalityTypeRequired
mirax-embedresponsivenessanyyes
data-e-widthdynamic widthintegeryes
data-e-heightdynamic heightintegeryes
data-e-fullscreenenable fullscreenbooleanoptional (true false)
data-e-controlsenable controllersbooleanoptional (true false )
data-e-autoplayenable autoplaybooleanoptional (true false)
data-e-loopenable loopbooleanoptional (true false)
data-e-urlvideo address, url/linksanyyes

TypeScript

  • located at repository files
src/react/TypeScriptPlayer.md
src/react/TypeScriptEmbed.md
src/vue/TypeScriptPlayer.md
src/vue/TypeScriptEmbed.md
src/svelte/TypeScriptPlayer.md
src/svelte/TypeScriptEmbed.md

React embed

import React, { useEffect } from "react";
import { embed } from 'mirax-player';

const ExampleComponent = () => {
  useEffect(() => {
    embed("mirax-embed"); 
  }, []);
  return (
    <div className="mirax-embed"
      data-e-width="640" // 800 x 450 or 1000 x 562.5
      data-e-height="360"
      data-e-autoplay="false" // for autoplay set true or remove this props
      data-e-url="https://vimeo.com/217499569">
    </div>
  );
};
export default ExampleComponent;

Vue embed

<template>
  <div class="mirax-embed"
       data-e-width="640" // 800 x 450 or 1000 x 562.5
       data-e-height="360"
       data-e-autoplay="false" // for autoplay set true or remove this props
       data-e-url="https://vimeo.com/217499569">
  </div>
</template>

<script>
import { onMounted } from "vue";
import { embed } from 'mirax-player';

export default {
  setup() {
    onMounted(() => {
        embed('mirax-embed');
    });
    return {};
  }
};
</script>

Angular embed

import { Component, OnInit } from '@angular/core';
import { embed } from 'mirax-player';

@Component({
  selector: 'app-example',
  templateUrl: './example.component.html',
  styleUrls: ['./example.component.css']
})
export class ExampleComponent implements OnInit {
  constructor() { }
  ngOnInit(): void {
    embed('mirax-embed'); 
  }
}

example.component.html


<div class="mirax-embed"
      data-e-width="640"
      data-e-height="360"
      data-e-autoplay="false"
      data-e-url="https://vimeo.com/217499569">
</div>

Svelte embed

<script>
  import { onMount } from 'svelte';
  import { embed } from 'mirax-player';

  onMount(() => {
    embed('mirax-embed');
  });
</script>

<div class="mirax-embed"
     data-e-width="640" // 800 x 450 or 1000 x 562.5
     data-e-height="360"
     data-e-autoplay="false" // for autoplay set true or remove this props
     data-e-url="https://vimeo.com/217499569">
</div>

Video-player

Mirax player propsFunctionalityTypeRequired
player-selectorresponsivenessanyyes
data-player-widthdynamic widthintegeryes
data-player-floatdynamic alignmentstringoptional
data-player-themeplayer coloranyoptional
data-player-barprogress bar coloranyoptional

Keyboard shortcutsFunctionsDescription
press space barPlay & PauseThe video will play or pause
press alt+pPiPPicture in Picture screen
press left arrow keyrewind clipbackward for 10 sec.
press right arrow keyadvance clipforward for 10 sec.

  • location of videos stored:

    public/clip.mp4 from your frameworks

    assets/clip.mp4 -Angular

    example.com/video/clip.mp4 (url)


React video player

import React, { useEffect, useRef } from "react";
import { miraxPlayer } from 'mirax-player';

const ExampleComponent = () => {
  const playerDiv = useRef(null);
  useEffect(() => {
      miraxPlayer(playerDiv.current);
  },[]);
  return (
    <div className="player-selector">
      <video className="mirax-player" ref={playerDiv}
        data-player-width="800"
        src="clip.mp4">
      </video>
    </div>
  );
};
export default ExampleComponent;

Vue video player

<template>
  <div class="player-selector">
    <video ref="videoPlayer"
      class="mirax-player"
      data-player-width="800"
      src="clip.mp4">
    </video>
  </div>
</template>

<script>
import { ref, onMounted } from "vue";
import { miraxPlayer } from 'mirax-player';

export default {
  setup() {
    const videoPlayer = ref(null);
    onMounted(() => {
        miraxPlayer(videoPlayer.value);
    });
    return {
      videoPlayer
    };
  }
};
</script>

Angular video player


example.component.ts

import { Component, ElementRef, ViewChild, AfterViewInit } from '@angular/core';
import { miraxPlayer } from 'mirax-player';

@Component({
  selector: 'app-example',
  templateUrl: './example.component.html',
  styleUrls: ['./example.component.css']
})
export class ExampleComponent implements AfterViewInit {
  @ViewChild('videoPlayer', { static: true }) videoPlayer!: ElementRef<HTMLVideoElement>;
  ngAfterViewInit(): void {
    this.initializemiraxPlayer();
  }
  initializemiraxPlayer() {
      miraxPlayer(this.videoPlayer.nativeElement);
  }
}

example.component.html


  <div class="player-selector">
    <video #videoPlayer
      class="mirax-player"
      data-player-width="800"
      src="assets/clip.mp4">
    </video>
  </div>

Svelte video player

<script>
  import { onMount } from 'svelte';
  import { miraxPlayer } from 'mirax-player';

  let videoPlayer;
  onMount(() => {
      miraxPlayer(videoPlayer);
  });
</script>

<div class="player-selector">
  <video bind:this={videoPlayer} class="mirax-player"
      data-player-width="800"
      src="clip.mp4">
    <track kind="captions" src="" label="English" default>
  </video>
</div>

CSS-player

  • Left
      data-player-float="left"
  • Center
      data-player-float="" // center is default
      //or
      data-player-float="center"
  • Right
      data-player-float="right"

Examples:

      data-player-theme="rgba(250, 149, 35, 0.9)"
      data-player-bar="rgba(17, 117, 59, 0.9)"
      data-player-theme="rgb(0,0,0)"
      data-player-bar="rgb(255, 255, 255)"
      data-player-theme="#000000"
      data-player-bar="#00ff00"
      data-player-theme="black"
      data-player-bar="red"

If you want pure transparent:

     data-player-theme = "rgba(0, 0, 0, 0)"

Colors

Color TypesColor syntaxExampleOpacity RangeAppearance
RGBArgba()rgba(255,0,0, 0.5)0.1 to 0.9 or 0 and 1Red half transparency
RGBrgb()rgb(255, 0, 0)noneRed
HEXA#6digits#ff0000noneRed
COLORNAMEcolornamerednoneRed

License

MIT

  • This library package is FREE for commercial or personal use. ❤️

Author

Demjhon Silver

  • Thank you for your support. 😃

Keywords

FAQs

Package last updated on 20 Mar 2024

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