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.

  • 5.0.0-beta.3
  • Source
  • npm
  • Socket score

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

Logo

Mirax Player

Npm version Build Status Downloads License


Disclaimer: This image is based on an example TikTok embedded video clip.

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

Major changes:

  • Updates the UI video player with backward & forward buttons
  • Mirax embed officially supports Twitter and Dailymotion videos
  • Mirax tags have been replaced with readability new terms and some are optionals.

Minor changes:

  • Minimize the parameters.

Patch changes:

  • 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/news/player-api/embed-dailymotion-video-oembed/
TwitterTwitter / XJavaScript APIhttps://developer.twitter.com/en/docs/twitter-for-websites/javascript-api/guides/set-up-twitter-for-websites

Embed-video

Mirax embed tagsFunctionalityTypeRequired
class-mirax-embedresponsivenessanyyes
data-mirax-embed-widthdynamic widthintegeryes
data-mirax-embed-heightdynamic heightintegeryes
data-mirax-embed-fullscreenenable fullscreenbooleanoptional (true false)
data-mirax-embed-controlsenable controllersbooleanoptional (true false )
data-mirax-embed-autoplayenable autoplaybooleanoptional (true false)
data-mirax-embed-loopenable loopbooleanoptional (true false)
data-mirax-embed-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, useRef } from "react";
import { miraxEmbed } from 'mirax-player';

const ExampleComponent = () => {
  const embedVideo = useRef(null);
  useEffect(() => {
    miraxEmbed(embedVideo.current);
  });
  return (
    <div className="class-mirax-embed"
        ref={embedVideo}
        data-mirax-embed-width="640"
        data-mirax-embed-height="360"
        data-mirax-embed-url="https://vimeo.com/217499569">
    </div>
  );
};
export default ExampleComponent;

Vue embed

<template>
  <div class="class-mirax-embed">
    <div ref="embedVideo"
        data-mirax-embed-width="640"
        data-mirax-embed-height="360"
        data-mirax-embed-url="https://vimeo.com/217499569">
    </div>
  </div>
</template>

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

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

Angular embed

import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { miraxEmbed } from 'mirax-player';
@Component({
  selector: 'app-example',
  templateUrl: './example.component.html',
  styleUrls: ['./example.component.css']
})
export class ExampleComponent implements OnInit {
  @ViewChild('embedVideo', { static: true }) embedVideo!: ElementRef;
  constructor() { }
  ngOnInit(): void {
    miraxEmbed(this.embedVideo.nativeElement);
  }
}

example.component.html


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

Svelte embed

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

  let embedVideo;
 
  onMount(() => {
    miraxEmbed(embedVideo);
  });
</script>

<div class="class-mirax-embed">
  <div bind:this={embedVideo}
     data-mirax-embed-width="640"
     data-mirax-embed-height="360"
     data-mirax-embed-url="https://vimeo.com/217499569">
  </div>
</div>

Video-player

Mirax player tagsFunctionalityTypeRequired
class-mirax-playerresponsivenessanyyes
data-mirax-player-widthdynamic widthintegeryes
data-mirax-player-floatdynamic alignmentstringoptional
data-mirax-player-themeplayer coloranyoptional
data-mirax-player-barprogress bar coloranyoptional

Keyboard shortcutsFunctionsDescription
press space barPlay & PauseThe video will play or pause
press alt+pPiPPicture in Picture screen
press left arrow keyProgress barbackward for 10 sec.
press right arrow keyProgress barforward for 10 sec.


React video player

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

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

Vue video player

<template>
  <div class="class-mirax-player">
    <video ref="videoPlayer"
      class="mirax-player"
      data-mirax-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(() => {
      if (videoPlayer.value) {
        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() {
    if (this.videoPlayer.nativeElement) {
      miraxPlayer(this.videoPlayer.nativeElement);
    }
  }
}

example.component.html


  <div class="class-mirax-player">
    <video #videoPlayer
      class="mirax-player"
      data-mirax-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(() => {
    if (videoPlayer) {
      miraxPlayer(videoPlayer);
    }
  });
</script>

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

CSS-player

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

Examples:

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

If you want pure transparent:

     data-mirax-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

Author

Demjhon Silver

  • This library package is FREE for commercial or personal use. ❤️
  • Thank you for your support. 😃

Keywords

FAQs

Package last updated on 16 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