Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/artrix9095/media-proxy
A simplistic yet flexible way to proxy your media.
https://github.com/artrix9095/media-proxy
Last synced: about 2 months ago
JSON representation
A simplistic yet flexible way to proxy your media.
- Host: GitHub
- URL: https://github.com/artrix9095/media-proxy
- Owner: Artrix9095
- License: mit
- Created: 2022-05-04T02:57:39.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-05-21T03:53:42.000Z (over 2 years ago)
- Last Synced: 2024-10-22T04:26:46.996Z (3 months ago)
- Language: TypeScript
- Homepage:
- Size: 146 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Node Media Proxy
A simplistic yet flexible way to proxy your media.
## Features
- 🔴 Simple HLS Integration.
- 🧩 Express compatable.
- 🔌 Plugin-based Ecosystem.
- 🍃 Lightweight.
- ⚡ Easy to set up.## Installation
Install with npm
```bash
npm install media-proxy
```Install with yarn
```bash
yarn add media-proxy
```
## Usage/Examples### Server
#### Standalone
```js
const { Proxy } = require('media-proxy');
const proxy = new Proxy({
port: 8080
}); // Server listens by default
```#### Express
```js
const app = require('express')();const { Proxy } = require('media-proxy');
const proxy = new Proxy();
app.use('/proxy', proxy.asRouter());
app.listen(8080);
```### Client
#### Browser
```js
const video = document.getElementById('#my-video');const options = {
url: 'https://example.com/example.mp4',
headers: {
referrer: 'https://example.com'
}
};const base64 = window.btoa(JSON.stringify(options));
const url = `http://localhost:8080/mpeg/${base64}`;
video.src = url;
```
#### Node
```js
const options = {
url: 'https://example.com/example.mp4',
headers: {
referrer: 'https://example.com'
}
};const base64 = Buffer
.from(JSON.stringify(options))
.toString('base64url'); // Use base64url and not base64const url = `http://localhost:8080/mpeg/${base64}`;
...
```## API Reference
WIP