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 has compatibility of typescript and javascript for React, Vue, Angular and Svelte.

  • 2.3.1-alpha
  • Source
  • npm
  • Socket score

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

Logo

Mirax Player

Latest npm version


Table of Contents

Description

Mirax Player is a video player has compatibility of typescript and javascript for React, Vue, Angular and Svelte. You can customize the theme color of the video player. Robust and easy to implement with readability syntax and light-weight.

React Vue.js Angular Svelte

Compatibility for scripts and coding syntax:

JavaScript TypeScript

Compatibility for web browsers:

Google Chrome Firefox Edge Opera


Installation

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

npm install mirax-player

Controllers

Keyboard keys / buttonsFunctionsDescriptionSupported Browsers
space barPlay & PauseThe video will play or pauseAll browsers
clickPlay & PauseThe video will play or pauseAll browsers
alt+p or cmd+pPiPPicture in Picture screen!firefox auto 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

Usage

In your component


Then use it from Mirax Player:


//both react,vue, angular and svelte importing syntax

import { miraxplayer } from 'mirax-player';

// for react (video file stored: public/clip.mp4)
  const video = useRef(null);
//
// for vue (video file stored: public/clip.mp4)
    const video = ref(null);
//
// for angular (video file stored: src/assets/clip.mp4)
  @ViewChild('video', { static: true })
//
// for svelte (video file stored: public/clip.mp4)
   let video;
//

React

In your React component

You need to use useRef in React hooks:


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

const ExampleComponent = () => {
  const video = useRef(null);
  useEffect(() => {
    if (video.current) {
      miraxplayer(video.current);
    }
  }, []);
  
  return (
    <div className='whatever'>
      <video ref={video} className="mirax-player" src="clip.mp4"></video>
    </div>
  );
};
export default ExampleComponent;



Typescript: React


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

const ExampleComponent: React.FC = () => {
  const video = useRef<HTMLVideoElement>(null);
  useEffect(() => {
    if (video.current) {
      miraxplayer(video.current);
    }
  }, []);
  
  return (
    <div className='whatever'>
      <video ref={video} className="mirax-player" src="clip.mp4"></video>
    </div>
  );
};
export default ExampleComponent;


Vue

In your Vue component

You need to use ref in Vue attributes:


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

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

export default {
  name: 'ExampleComponent',
  setup() {
    const video = ref(null);

    onMounted(() => {
      if (video.value) {
        miraxplayer(video.value);
      }
    });

    return {
      video
    };
  }
};
</script>


Typescript: Vue


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

<script lang="ts">
import { ref, onMounted } from 'vue';
import { miraxplayer } from 'mirax-player';

export default {
  name: 'ExampleComponent',
  setup() {
    const video = ref<HTMLVideoElement | null>(null);

    onMounted(() => {
      if (video.value) {
        miraxplayer(video.value);
      }
    });

    return {
      video
    };
  }
};
</script>


Angular

In your Angular component


You need to use ElementRef native DOM element:

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>;

  ngOnInit(): void {
    this.initializeMirax();
  }

  initializeMirax() {
    if (this.video.nativeElement) {
      new miraxplayer(this.video.nativeElement).init();
    }
  }
}



example.component.html



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



Svelte

In your Svelte component


You need to use bind:this in svelte:


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

  let video;

  onMount(() => {
    if (video) {
      miraxplayer(video);
    }
  });
</script>

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


Typescipt: Svelte


<script lang="ts">
  import { onMount } from 'svelte';
  import { miraxplayer } from 'mirax-player';

  let video: HTMLVideoElement;

  onMount(() => {
    if (video) {
      miraxplayer(video);
    }
  });
</script>

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



To customize the alignment of video:

  • note: .whatever, you can rename it, just make sure the classname in your component also replace it.

// in React 
 <div className='whatever'>
        <video ref={video} className="mirax-player" src="clip.mp4"></video>
</div>

// in Vue 
<div class="whatever">
      <video ref="video" class="mirax-player" src="clip.mp4"></video>
 </div>

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

// in Svelte
 <div class='whatever'>
   <video bind:this={video} class="mirax-player" src="clip.mp4">
      <track kind="captions" src="" label="English" default>
   </video>
 </div>


Left Alignment: ( 3 progress syntax should be remain )

.whatever {
  margin: 0 auto;
  position: relative;
  width: 100%;
  text-align: left;
}
.mirax-theme {
  float: left!important;
  background-color: rgba(36, 22, 223, 0.5)!important;
}
progress::-webkit-progress-value {
  background-color: rgb(65, 7, 224, 0.9)!important;
} 
progress[value]::-moz-progress-bar {
  background-color: rgb(65, 7, 224, 0.9)!important;
}
progress::-ms-fill {
  background-color: rgb(65, 7, 224, 0.9)!important;
}


Center Alignment: ( 3 progress syntax should be remain )


.whatever {
  margin: 0 auto;
  position: relative;
  width: 100%;
  text-align: center;
}
.mirax-theme {
  margin: 0 auto!important;
  background-color: rgba(36, 22, 223, 0.5)!important;
}
progress::-webkit-progress-value {
  background-color: rgb(65, 7, 224, 0.9)!important;
}
progress[value]::-moz-progress-bar {
  background-color: rgb(65, 7, 224, 0.9)!important;
}
progress::-ms-fill {
  background-color: rgb(65, 7, 224, 0.9)!important;
}





Right Alignment: ( 3 progress syntax should be remain )


.whatever {
  margin: 0 auto;
  position: relative;
  width: 100%;
  text-align: right;
}
.mirax-theme {
  float: right!important;
  background-color: rgba(36, 22, 223, 0.5)!important;
}
progress::-webkit-progress-value {
  background-color: rgb(65, 7, 224, 0.9)!important;
} 
progress[value]::-moz-progress-bar {
  background-color: rgb(65, 7, 224, 0.9)!important;
}
progress::-ms-fill {
  background-color: rgb(65, 7, 224, 0.9)!important;
}



Style

You can set your own class name to wrap the video player

.whatever {
    margin: 0 auto;
    position: relative;
    width: 100%;
}


Colors

You have freedom to set a theme color for free.

To change color and theme, just add to your css file

Reminder for progress bar: 3 progress syntax must declared


progress::-webkit-progress-value {
  //change color here
} 
progress[value]::-moz-progress-bar {
  //change color here
}
progress::-ms-fill {
  //change color here
}


-note always put !important at the end of statement.



.mirax-theme {
    background-color: rgba(4, 88, 25, 0.2)!important;
}
progress::-webkit-progress-value {
    background-color: rgb(252, 227, 7)!important;
} 
progress[value]::-moz-progress-bar {
    background-color: rgb(252, 227, 7)!important;
}
progress::-ms-fill {
    background-color: rgb(252, 227, 7)!important;
}


Color css syntax supported:

Transparency color mode:

  • rgba() -> means have opacity add: !important;

Solid color mode:

  • rgb() -> means no opacity add: !important;
  • hexa -> starts with # symbol ex. #00ff00 add: !important;
  • colorname -> specific name: ex. red, blue, purple add: !important;

if you want pure transparent, mirax-theme only:

change into:


.mirax-theme {
 background: none !important;
}


Sample themes:



.mirax-theme {
  background-color: purple!important;
}
progress::-webkit-progress-value {
  background-color: lime!important;
} 
progress[value]::-moz-progress-bar {
  background-color: lime!important;
}
progress::-ms-fill {
  background-color: lime!important;
}




.mirax-theme {
  background-color: rgba(250, 149, 35, 0.9)!important;
}
progress::-webkit-progress-value {
  background-color: rgb(17, 117, 59)!important;
} 
progress[value]::-moz-progress-bar {
  background-color: rgb(17, 117, 59)!important;
}
progress::-ms-fill {
  background-color: rgb(17, 117, 59)!important;
}




.mirax-theme {
  background: none !important;
}
progress::-webkit-progress-value {
  background-color: rgba(253, 75, 90, 0.897)!important;
} 
progress[value]::-moz-progress-bar {
  background-color: rgba(253, 75, 90, 0.897)!important;
}
progress::-ms-fill {
  background-color: rgba(253, 75, 90, 0.897)!important;
}




.mirax-theme {
  background: none !important;
}
progress::-webkit-progress-value {
  background-color: rgba(250, 234, 5, 0.7)!important;
} 
progress[value]::-moz-progress-bar {
  background-color: rgba(250, 234, 5, 0.7)!important;
}
progress::-ms-fill {
  background-color: rgba(250, 234, 5, 0.7)!important;
}



Features

  • Play and Pause
  • Responsive
  • Auto hide the player bar
  • Can play videos (Portrait or Landscape)
  • 9:16 dimension supported (Mobile video)
  • Fullscreen
  • Adjust the volume (low or high)
  • Can change color themes
  • You can point and drag the timestamp in video time duration anywhere
  • PIP supported (picture in picture) will play the clip even if you leave the tab open for new app

License

MIT


Author

Demjhon Silver

Keywords

FAQs

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