Skip to content

Commit

Permalink
Mirax embed officially supports Twitter and Dailymotion videos
Browse files Browse the repository at this point in the history
  • Loading branch information
demjhonsilver committed Sep 16, 2023
1 parent dfcd7e3 commit b87409c
Show file tree
Hide file tree
Showing 24 changed files with 967 additions and 1,041 deletions.
715 changes: 207 additions & 508 deletions README.md

Large diffs are not rendered by default.

555 changes: 323 additions & 232 deletions dist/MiraxPlayer.js

Large diffs are not rendered by default.

361 changes: 274 additions & 87 deletions dist/miraxEmbedder.js

Large diffs are not rendered by default.

65 changes: 57 additions & 8 deletions dist/miraxplayerUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

// Define the content string
const content_fullscreen = "\\02752";
const content_backward = "\\27A4";
const content_play = "\\25B6";
const content_forward = "\\27A4";
const content_pause = "|" + " " + "|";
const content_speaker = "\\1F508";
const content_pip = "\\0393";
Expand All @@ -19,10 +21,10 @@ const styles = `
.play-button {
position: relative;
margin-left: 20px;
transform: translateX(-50%);
position: absolute;
left: 50%;
background: none;
margin-left:3px;
color: #fff;
border-style: none;
border-radius: 0;
Expand Down Expand Up @@ -58,14 +60,58 @@ const styles = `
.backward-button {
position: absolute;
left:45%;
background: none;
color: #fff;
border-style: none;
border-radius: 0;
cursor: pointer;
font-size: 13px;
transform: scaleX(-1);
transition: background-color 0.3s ease, transform 0.3s ease;
}
.backward-button::before {
content: "${content_backward}";
font-size: 13px;
appearance: none;
}
.forward-button {
position: absolute;
left: 55%;
background: none;
color: #fff;
border-style: none;
border-radius: 0;
cursor: pointer;
font-size: 13px;
transition: background-color 0.3s ease, transform 0.3s ease;
}
.forward-button::before {
content: "${content_forward}";
font-size:13px;
appearance: none;
}
/* Style the volume slider */
.volume-slider {
transform: rotate(-90deg); /* Rotate the thumb to match the vertical slider */
position: absolute;
right: 0;
margin-right:73px;
top:0;
margin-top:-30px;
margin-top:-34px;
width:50px;
height: 3px;
outline: none;
Expand Down Expand Up @@ -209,8 +255,6 @@ const styles = `
}
progress::-webkit-progress-value {
background-color: rgba(45, 85, 255, 0.9);
Expand All @@ -224,6 +268,12 @@ progress::-ms-fill {
}
.pip-button {
min-width:20px;
width: 100%;
Expand Down Expand Up @@ -345,7 +395,7 @@ const mediaQuery = `
display: block;
margin: 0 auto;
position: relative;
width:100%;
width: 95%;
height: 20px;
max-width:96%;
margin-top:-44px;
Expand All @@ -357,7 +407,6 @@ const mediaQuery = `
display: flex;
justify-content: space-between;
align-items: center;
border-radius:3px;
}
}
Expand Down
Binary file modified img/theme1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//index.js - This is your package's entry point

export { default as miraxplayer } from './dist/MiraxPlayer';
export { default as miraxPlayer } from './dist/MiraxPlayer';
export { default as miraxEmbed } from './dist/miraxEmbedder';


Expand Down
12 changes: 5 additions & 7 deletions mirax-player.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@ declare module 'mirax-player' {

// Type for the VideoEmbed function
type VideoEmbed = (
playerRef: HTMLDivElement | null,
youtubeParams: { [key: string]: any },
vimeoParams: { [key: string]: any }
urlSource: HTMLDivElement | null
) => void;

// Type for the VideoPlayerFunction
type VideoPlayerFunction = (
// Type for the VideoPlayer function
type VideoPlayer = (
videoClip: HTMLVideoElement
) => void;

// Export the VideoEmbed and VideoPlayerFunction types
// Export the VideoEmbed and VideoPlayer types
export const miraxEmbed: VideoEmbed;
export const miraxplayer: VideoPlayerFunction;
export const miraxPlayer: VideoPlayer;
}
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mirax-player",
"version": "4.0.1",
"description": "Mirax Player is a powerful free video player for React, Vue, Angular, and Svelte that can embed videos from platforms like TikTok, YouTube/Shorts, and Vimeo.",
"version": "5.0.0",
"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.",
"main": "index.js",
"types": "mirax-player.d.ts",
"scripts": {
Expand All @@ -20,6 +20,8 @@
"youtube",
"vimeo",
"tiktok",
"dailymotion",
"twitter",
"javascript",
"typescript",
"react",
Expand Down
10 changes: 4 additions & 6 deletions src/angular/ExampleEmbed.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
```html
<div class="mirax-embed-class">
<div class="class-mirax-embed">
<div #embedVideo
data-mirax-width="640"
data-mirax-height="360"
data-mirax-fullscreen="true"
data-mirax-controls="true"
data-mirax-embed="https://vimeo.com/217499569">
data-mirax-embed-width="640"
data-mirax-embed-height="360"
data-mirax-embed-url="https://vimeo.com/217499569">
</div>
</div>
```
10 changes: 3 additions & 7 deletions src/angular/ExamplePlayer.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
```html
<div>
<div class="mirax-player-class">
<div class="class-mirax-player">
<video #videoPlayer
class="mirax-player"
data-mirax-player-width="800"
data-mirax-player-float=" "
data-mirax-player-theme=" "
data-mirax-player-bar=" "
src="assets/clip.mp4"></video>
src="assets/clip.mp4">
</video>
</div>
</div>
```
10 changes: 1 addition & 9 deletions src/angular/TypescriptEmbed.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,7 @@ export class ExampleComponent implements OnInit {
@ViewChild('embedVideo', { static: true }) embedVideo!: ElementRef;
constructor() { }
ngOnInit(): void {
const youtubeParams = {
playerVars: {
cc_load_policy: 1
}
};
const vimeoParams = {
responsive: true
};
miraxEmbed(this.embedVideo.nativeElement, youtubeParams, vimeoParams);
miraxEmbed(this.embedVideo.nativeElement);
}
}
```
8 changes: 4 additions & 4 deletions src/angular/TypescriptPlayer.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
```ts
import { Component, ElementRef, ViewChild, AfterViewInit } from '@angular/core';
import { miraxplayer } from 'mirax-player';
import { miraxPlayer } from 'mirax-player';

@Component({
selector: 'app-example',
Expand All @@ -10,11 +10,11 @@ import { miraxplayer } from 'mirax-player';
export class ExampleComponent implements AfterViewInit {
@ViewChild('videoPlayer', { static: true }) videoPlayer!: ElementRef<HTMLVideoElement>;
ngAfterViewInit(): void {
this.initializeMiraxplayer();
this.initializemiraxPlayer();
}
initializeMiraxplayer() {
initializemiraxPlayer() {
if (this.videoPlayer.nativeElement) {
miraxplayer(this.videoPlayer.nativeElement);
miraxPlayer(this.videoPlayer.nativeElement);
}
}
}
Expand Down
23 changes: 6 additions & 17 deletions src/react/JavascriptEmbed.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,15 @@ import { miraxEmbed } from 'mirax-player';

const ExampleComponent = () => {
const embedVideo = useRef(null);
const youtubeParams = {
playerVars: {
cc_load_policy: 1
}
};
const vimeoParams = {
responsive: true
};
useEffect(() => {
miraxEmbed(embedVideo.current, youtubeParams, vimeoParams);
miraxEmbed(embedVideo.current);
});
return (
<div className="mirax-embed-class">
<div ref={embedVideo}
data-mirax-width="640"
data-mirax-height="360"
data-mirax-fullscreen="true"
data-mirax-controls="true"
data-mirax-embed="https://vimeo.com/217499569">
</div>
<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>
);
};
Expand Down
19 changes: 9 additions & 10 deletions src/react/JavascriptPlayer.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
```js
import React, { useEffect, useRef } from "react";
import { miraxplayer } from 'mirax-player';
import { miraxPlayer } from 'mirax-player';

const ExampleComponent = () => {
const videoPlayer = useRef(null);
useEffect(() => {
if (videoPlayer.current) {
miraxplayer(videoPlayer.current);
miraxPlayer(videoPlayer.current);
}
});
return (
<div className="mirax-player-class">
<video ref={videoPlayer}
className="mirax-player"
data-mirax-player-width="800"
data-mirax-player-float=" "
data-mirax-player-theme=" "
data-mirax-player-bar=" "
src="clip.mp4"></video>
<div className="class-mirax-player">
<video ref={videoPlayer}
className="mirax-player"
data-mirax-player-width="800"
src="clip.mp4">
</video>
</div>
);
};
Expand Down
34 changes: 12 additions & 22 deletions src/react/TypescriptEmbed.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,26 @@
```ts
import React, { useEffect, useRef } from "react";
import React, { useEffect, useRef, RefObject } from "react";
import { miraxEmbed } from 'mirax-player';

const ExampleComponent: React.FC = () => {
const embedVideo = useRef<HTMLDivElement | null>(null);
const embedVideo: RefObject<HTMLDivElement> = useRef(null);

const youtubeParams = {
playerVars: {
cc_load_policy: 1
}
};
const vimeoParams = {
responsive: true
};
useEffect(() => {
if (embedVideo.current) {
miraxEmbed(embedVideo.current, youtubeParams, vimeoParams);
miraxEmbed(embedVideo.current);
}
});
}, []);

return (
<div className="mirax-embed-class">
<div
ref={embedVideo}
data-mirax-width="640"
data-mirax-height="360"
data-mirax-fullscreen="true"
data-mirax-controls="true"
data-mirax-embed="https://vimeo.com/217499569"
></div>
</div>
<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;
```
21 changes: 10 additions & 11 deletions src/react/TypescriptPlayer.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
```ts
import React, { useEffect, useRef } from "react";
import { miraxplayer } from 'mirax-player';
import { miraxPlayer } from 'mirax-player';

const ExampleComponent: React.FC = () => {
const videoPlayer = useRef<HTMLVideoElement | null>(null);

useEffect(() => {
if (videoPlayer.current) {
miraxplayer(videoPlayer.current);
miraxPlayer(videoPlayer.current);
}
});
}, []);

return (
<div className="mirax-player-class">
<video ref={videoPlayer}
className="mirax-player"
data-mirax-player-width="800"
data-mirax-player-float=" "
data-mirax-player-theme=" "
data-mirax-player-bar=" "
src="clip.mp4"></video>
<div className="class-mirax-player">
<video
ref={videoPlayer}
className="mirax-player"
data-mirax-player-width="800"
src="clip.mp4">
</video>
</div>
);
};
Expand Down
Loading

0 comments on commit b87409c

Please sign in to comment.