Code Monkey home page Code Monkey logo

vue-mini-player's Introduction

vue-mini-player

This is a simple mini player which is based on petite-vue

NOTE: This project will reconfigure it in 2024. :)

Features

  • 24kb size (CSS + JS without petite-vue).
  • Base function with a simple audio list.
  • Can move to page anywhere with mouse grab.
  • Simply operate.

Usage

Go to releases page to download it.

Use them in your html page:

<!-- .css file path -->
<link rel="stylesheet" href="mini-player.css">

<!-- Petite Vue CDN -->
<script src="https://unpkg.com/petite-vue"></script>

<script type="module">
  // import js file at here!!
  import VueMiniPlayerCore from 'mini-player.esm.js'

  const { PlayerCore } = new VueMiniPlayerCore()

  PlayerCore.AppendSong({
    name: "Libertas",
    id: "1",
    src: "./Libertas.mp3"
  })
</script>

Then you can find it appear on your page right bottom corner.

If you don't want to use cdn file of js you can import the full ver which include full pvue:

<!-- .css file path -->
<link rel="stylesheet" href="mini-player.css">

<script type="module">
  // import js file at here!!
  import VueMiniPlayerCore from 'mini-player.full.esm.js'

  const { PlayerCore } = new VueMiniPlayerCore()

  PlayerCore.AppendSong({
    name: "Libertas",
    id: "1",
    src: "./Libertas.mp3"
  })
</script>

File size will increase ~17kb.

Mode explain

Play Song Mode

There are 4 mode to auto change song after audio ended.

  • Continue play until last song. (Default)
  • Loop all song.
  • Loop current song.
  • Play Randomly.

Move the player

Mouse move to the song title and grab it. Then you can begin to move it.

Please read API part to learn how to operate it.

API

Update irregularly.

If you want to get all api information, Please go to src/core/MusicPlayerCore/index.ts to get it.

SingleSongBriefInfo

Base info with a single song.

key type explaination
name string Song name, will appear on song name area.
id number Song id, use Object to collect.
src string Song audio source.
author string[] | undefined Song author.
album string | undefined Song album.
img string | undefined Song thumbnail, will appear at player left.

Operate the core

Get the player core

const { PlayerCore } = new VueMiniPlayerCore()

Add a song

This is an example to add a song, it can also append at head!

const { PlayerCore } = new VueMiniPlayerCore()

PlayerCore.AppendSongOnTail({
  name: 'Untitled World', 
  id: 2, 
  src: '',  // Your audio.
  img: ''   // Your thumbnail.
})

Remove a song

In most of situation you can remove by song list button in the player. But also you can remove it by api:

// remove by api
PlayerCore.RemoveSong(0)

License

MIT

vue-mini-player's People

Contributors

qingxia-ela avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

vue-mini-player's Issues

issue

Hello i did not know how to make it work may i send my index.html and you can help me add it thanks <3

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.