Giter Club home page Giter Club logo

nmp-player's Introduction

nmp-player

Node Minecraft Protocol Media Player

Description

Play .nbs music and mp4 etc videos inside minecraft using minecraft-protocol or anything of your choice

Contributing

Feel free to open an issue or a pull request! :D

Install

Available on npm npm install nmp-player

TODO

If you can do any of these and have free time to do so, you are free to open a PR :3

  • Probably a subtitle player (needs xml parsing i think)
  • Propose a json/file structure for medias
  • Stream mode for VideoPlayer

API

module.exports

  • MediaPlayer
  • VideoPlayer
  • SongPlayer
  • VideoProcessor
  • DisplayList
  • MapData

new nmp.MediaPlayer()

Abstract class containing basic methods. You can use this to make your own media players.

Extends EventEmitter

player.setVolume(number: v)

Set the volume

player.setFrameRate(number: fps)

Set the framerate (FPS, frames per second)

player.setSpeed(number: speed)

Set the playback speed. Default is 1

player.progress

Returns a percentage (0 to 100) of the player's progress. Is always 100 is player.isStream is true

player.duration

Get the duration of the media in milliseconds

player.play([boolean: fromStart])

Play or resume, if fromStart is true, plays the media from the beginning, otherwise resumes if paused

player.pause()

Pause the media

player.stop()

Stops playing and rewinds to the start

player.seekTo(number: f)

player.seek(number: f)

player.forward(number: f)

player.rewind(number: f)

seekTo, seek, rewind or forward the playback.

  • f : the frame count

player.seekToSeconds(number: s)

player.seekSeconds(number: s)

player.forwardSeconds(number: s)

player.rewindSeconds(number: s)

seekTo, seek, rewind or forward the playback.

  • s : amount in seconds

player.loop : boolean

If true, loops when the player ends playing

event loopRestart

The media started playing again because loop is on

event end

The media ended

event started

event stop

event paused

speaks for itself

event forceStop

Forcefully stopped, one reason why is player.play(true)

Stream mode

Stream mode is a mode where the playback excepts frames to be ready.

player.isStream : boolean

If true, the player is in stream mode. If false, it isnt.

player.addFrame(frame)

Add the frame, calling this in non-stream mode might have side effects

player.addBulkFrames(frame[])

player.addFrame but in bulk

event buffering

Emitted when the player starts to wait for input, aka use this to show a loading icon idk

event bufferingEnd

Emitted when buffering ends

new nmp.VideoPlayer() extends MediaPlayer

All methods in MediaPlayer are present

  • Stream mode is not supported

Update Logs

1.0.2

  • Added SongPlayer
  • Server is now optional for VideoPlayer
  • Added the ability to add custom frame display functions to VideoPlayer

1.0.1

  • Changed Converter class function names to be more understandable

nmp-player's People

Contributors

thealan404 avatar

Stargazers

ColorBuffer avatar TheBlueBurger avatar  avatar

Watchers

 avatar

nmp-player's Issues

1.16.5 supported?

Hi, Thanks for the repo

Im trying to use your code for 1.16.5 but there is a problem in "login" section. (where the client tries to login)

The Server throws a JSON parse exception. I think the protocol is changed since 1.12.2

Can You help me to get rid of this error?

VideoPlayer is not dynamic enough

Cannot use custom displays (for example use a websocket to send video to everyone)
And most importantly needs multi-display support (more than one map, bigger resolution than 128*128)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.