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 video player and embedding videos for React, Vue, Angular, and Svelte. That can embed videos like Youtube/Shorts and Vimeo

  • 3.1.0-alpha.1
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-96.69%
Maintainers
1
Weekly downloads
 
Created
Source

Logo

Mirax Player

Npm version Downloads !License

Table of Contents

Description

Mirax Player is an adaptable video player and embedding solution that seamlessly integrates with TypeScript and JavaScript applications across a range of popular front-end libraries and frameworks, including React, Vue, Angular, and Svelte. It was written in pure JavaScript but can be implemented in both TypeScript and JavaScript.

React Vue.js Angular Svelte

Changes

  • You can set any color themes inside to your component for video player.
  • You can set dynamic width and height while embedding videos.
  • No need to add "embed_clip" for your embed css
  • Params for width and height are move to inline embed tag.

  • Reminder: This is alpha test.
  • Since Mirax embed supports YouTube shorts, I will try to include embed TikTok videos, hopefully soon. :)
  • I'm just trying to improve the mirax syntax implementation, to make it clean and short as much as possible.
  • Please follow me on my Github, Thank you for your supports.

Features

  • Easy to use and responsive
  • Can embed videos like YouTube, YouTube Shorts and Vimeo
  • Capable of playing videos (Portrait or Landscape)
  • Supports 9:16 dimensions (Mobile video)
  • Fullscreen functionality
  • 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

Embed

SitesSourceControl ParamsLinks
YouTube / ShortsIframe Apihttps://developers.google.com/youtube/player_parametershttps://developers.google.com/youtube/iframe_api_reference
VimeoPlayer SDKhttps://developer.vimeo.com/player/sdk/embedhttps://developer.vimeo.com/player/sdk
Mirax embed tagsTypeFunctionality
mirax-embed-classclass nameresponsiveness
data-mirax-widthattributedynamic width
data-mirax-heightattributedynamic height
data-mirax-embedattributevideo links to embed

example: as of now In React app

<div className="mirax-embed-class">
  <div ref={embedVideo}
      data-mirax-width="640" // you can set any value
      data-mirax-height="360" // you can set any value
      data-mirax-embed="https://vimeo.com/217499569">
  </div>
</div>

Player

Keyboard keys / buttonsFunctionsDescriptionSupported Browsers
space barPlay & PauseThe video will play or pauseAll browsers
clickPlay & PauseThe video will play or pauseAll browsers
alt+pPiPPicture in Picture screen!firefox but auto appear PiP icon
click ΓPiPPicture in Picture screenAll browsers
double click the videoFullscreenIt will set as fullscreen modeAll browsers
clickFullscreenIt will set as fullscreen modeAll browsers
swipe for volumeVolumeTo adjust the volume levelAll browsers
swipe for time frameProgress barTo adjust video frame timestampAll browsers

input:


src=" " // Link  public/clip.mp4 in your frameworks | assets/clip.mp4 angular | example.com/video/clip.mp4


React

import React, { useEffect, useRef } from "react";
import { miraxplayer } from 'mirax-player';
const ExampleComponent = () => {
  const videoRef = useRef(null);
  const miraxCustomizer = {
    playerTheme: "",
    progressTheme:  ""
  };
  useEffect(() => {
    if (videoRef.current) {
      miraxplayer(videoRef.current, miraxCustomizer);
    }
  });
  return (
    <div className="whatever">
      <video ref={videoRef} className="mirax-player" src="clip.mp4"></video>
    </div>
  );
};
export default ExampleComponent;
  • Embed videos

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

const ExampleComponent = () => {
  const embedVideo = useRef(null);
  const youtubeParams = {
    playerVars: { 
      controls: 1,
      autoplay: 0,
      fs: 1,
      iv_load_policy: 3,
      cc_load_policy: 1 
    }
  };
  const vimeoParams = { 
    autopause: 0, 
    controls: true,
    responsive: true
  };
  useEffect(() => {
    miraxEmbed(embedVideo.current, youtubeParams, vimeoParams);
  });
  return (
    <div className="mirax-embed-class">
      <div ref={embedVideo}
          data-mirax-width="1040"
          data-mirax-height="560"
          data-mirax-embed="https://vimeo.com/217499569">
      </div>
    </div>
  );
};
export default ExampleComponent;
  • For TypeScript version: ( located at repository file )
src/react/TypeScriptComponent.md
src/react/TypeScriptEmbed.md

Vue

<template>
  <div class="whatever">
    <video ref="videoRef" class="mirax-player" src="clip.mp4"></video>
  </div>
</template>
<script>
import { miraxplayer } from 'mirax-player';
import { ref, onMounted } from 'vue';
export default {
  setup() {
    const videoRef = ref(null);
    const miraxCustomizer = {
      playerTheme: "",
      progressTheme:  ""
    };
    onMounted(() => {
      if (videoRef.value) {
        miraxplayer(videoRef.value, miraxCustomizer);
      }
    });
    return {
      videoRef
    };
  }
};
</script>

Angular



example.component.ts

import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { miraxplayer } from 'mirax-player';
@Component({
  selector: 'app-example',
  templateUrl: './example.component.html',
  styleUrls: ['./example.component.css']
})
export class ExampleComponent implements OnInit {
  @ViewChild('video', { static: true }) video!: ElementRef<HTMLVideoElement>;
  miraxCustomizer = {
    playerTheme: "",
    progressTheme: ""
  };
  ngOnInit(): void {
    this.initializeMiraxplayer();
  }
  initializeMiraxplayer() {
    if (this.video.nativeElement) {
      miraxplayer(this.video.nativeElement, this.miraxCustomizer);
    }
  }
}

example.component.html

<div>
  <div class="whatever">
    <video #video class="mirax-player" src="assets/clip.mp4"></video>
  </div>
</div>

Svelte

<script>
    import { onMount } from 'svelte';
    import { miraxplayer } from 'mirax-player';
  let video;
  const miraxCustomizer = {
      playerTheme: "",
      progressTheme:  ""
  };
  $: if(video) { 
    miraxplayer(video, playerTheme, miraxCustomizer);
  }
</script>
<div>
  <div class='whatever'>
    <video bind:this={video} class="mirax-player" src="clip.mp4">
      <track kind="captions" src="" label="English" default>
    </video>
  </div>
</div>

CSS-player

You can assign your own class name to encapsulate the video player.

  • Left
.whatever {
  margin: 0 auto;
  position: relative;
  width: 100%;
  float: left;
  text-align: left;
}
  • Center
 .whatever {
  position: relative;
  width: 100%;
  text-align: center;
}
  • Right
.whatever {
    margin: 0 auto;
    position: relative;
    width: 100%;
    float: right;
    text-align: right;
}
  const miraxCustomizer = {
      playerTheme: "",
      progressTheme:  ""
  };

Examples:

  const miraxCustomizer = {
      playerTheme: "rgba(250, 149, 35, 0.9)",
      progressTheme:  "rgba(17, 117, 59, 0.9)"
  };
  const miraxCustomizer = {
      playerTheme: "rgb(0,0,0)",
      progressTheme:  "rgb(255, 255, 255)"
  };
  const miraxCustomizer = {
      playerTheme: "#000000",
      progressTheme:  "#00ff00"
  };
  const miraxCustomizer = {
      playerTheme: "black",
      progressTheme:  "red"
  };

If you want pure transparent:

 const playerTheme = "rgba(0, 0, 0, 0)";

Colors

You have the freedom to freely set a theme color.

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

Keywords

FAQs

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