npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

merlmovie-sdk

v16.4.5

Published

A MerlMovie SDK to handle WebSocket request from plugin.

Downloads

46

Readme

MerlMovie SDK 😎

The MerlMovie SDK is a powerful software package developed by Harry Odinson to greatly simplify Node.js (TypeScript) plugin requests for the streaming feature.

Note: This package only works for WebSocket connections! If you want to handle HTTP requests, just use the express/etc package and follow the documentation here.

Code Example

👇 This code example creates a WebSocket handler and do the logic to get the direct video link and send it to the user.

import MerlMovieSDK, { DirectLink, sendTest } from "merlmovie-sdk";

const sdk = new MerlMovieSDK({ HOST: "localhost", PORT: 8080 });

sdk.handle({
    //This function used to receive the request from user and it contain all metadata needed.
    onStream({controller, request, media}) {
        
        //Do the logic here

        //Example result from the logic above
        //The link property in qualities array below support both video format .mp4 and .m3u8
        //And the link property in subtitles array below support both text format .srt and .vtt
        const result: DirectLink | undefined = {
            qualities: [
                {
                    name: "Big Buck Bunny - 1080p",
                    link: "https://example.com/video/big-buck-bunny-1080p.mp4",
                }
            ],
            subtitles: [
                {
                    name: "Big Buck Bunny - English",
                    link: "https://example.com/subtitle/big-buck-bunny-1080p.srt",
                }
            ]
        }

        //After the logic finished pass the final result to send back to user
        if (result) {
            controller.finish(result);
        } else {
            controller.failed();
        }

    },
});

🎉✌️ Now you can run it on your self-hosted server normally.

👇 How to use the SDK with express server.

// server.js
import express from 'express';
import { createServer } from 'http';
import MerlMovieSDK from 'merlmovie-sdk';
import { WebSocketServer } from 'ws';

const app = express();
const port = 3000;

// Create HTTP server
const server = createServer(app);

const WSS = new WebSocketServer({ server, path: "/ws" });

const sdk = new MerlMovieSDK({ WSS });

sdk.handle({
    async onStream(data, controller, request) {
        
        //Do the logic here and the result should be look like below
        const result: DirectLink | undefined = {
            qualities: [
                {
                    name: "Big Buck Bunny - 1080p",
                    link: "https://example.com/video/big-buck-bunny-1080p.mp4",
                }
            ],
            subtitles: [
                {
                    name: "Big Buck Bunny - English",
                    link: "https://example.com/subtitle/big-buck-bunny-1080p.srt",
                }
            ]
        }

        if (result) controller.finish(result);
        if (!result) controller.failed(); 
    },
    onConnection(ws, request) {
        console.log("A client connected " + request.socket.remoteAddress);
    },
    onListening() {
        console.log("WebSocket is listening...");
    },
});

// Express route
app.get('/', (req, res) => {
    res.send('Hello from Express server!');
});

// Start the server
server.listen(port, () => {
    console.log(`Server running on http://localhost:${port}`);
});

Plugin Metadata Structure

👇 Here is the plugin metadata structure that user will install it into the MerlMovie app. The embed_url is the url where you're going to host the code above.

{
   "embed_url": "wss://example.com/websocket_url",
   "name": "My Example Plugin",
   "stream_type": "api",
   "image": "https://example.com/logo/example.png",
   "logo_background_color": "#212121"
}

Report an issue

If you have any issues regarding the MerlMovie SDK, please feel free to report them here.