vue-peaks

所属分类:前端开发
开发工具:Vue
文件大小:15030KB
下载次数:0
上传日期:2023-06-07 20:12:23
上 传 者sh-1993
说明:  围绕bbc peaks.js音频波形UI组件的Vue包装器
(A Vue wrapper around the bbc peaks.js audio waveform UI component)

文件列表:
.vscode (0, 2023-09-18)
.vscode\extensions.json (86, 2023-09-18)
.vscode\settings.json (156, 2023-09-18)
CHANGELOG.md (651, 2023-09-18)
LICENSE (7651, 2023-09-18)
dist (0, 2023-09-18)
dist\android-chrome-192x192.png (10615, 2023-09-18)
dist\android-chrome-512x512.png (36886, 2023-09-18)
dist\apple-touch-icon.png (9524, 2023-09-18)
dist\assets (0, 2023-09-18)
dist\assets\index.052b9665.js (386397, 2023-09-18)
dist\assets\index.052b9665.js.map (1742580, 2023-09-18)
dist\assets\index.525b4f4f.css (3610, 2023-09-18)
dist\assets\peaks-logo.72e98b64.svg (19785, 2023-09-18)
dist\browserconfig.xml (246, 2023-09-18)
dist\favicon-16x16.png (1040, 2023-09-18)
dist\favicon-32x32.png (1337, 2023-09-18)
dist\favicon.ico (15086, 2023-09-18)
dist\index.html (1428, 2023-09-18)
dist\lidija_roos-decisions.ogg (3542766, 2023-09-18)
dist\lidija_roos-not_for_sale.mp3 (3807360, 2023-09-18)
dist\manifest.json (435, 2023-09-18)
dist\mstile-150x150.png (6860, 2023-09-18)
dist\safari-pinned-tab.svg (8328, 2023-09-18)
dist\site.webmanifest (444, 2023-09-18)
dist\src (0, 2023-09-18)
dist\src\App.vue.d.ts (341, 2023-09-18)
dist\src\components (0, 2023-09-18)
dist\src\components\AudioPeaks.vue.d.ts (2596, 2023-09-18)
dist\src\components\AudioPeaksWidget.vue.d.ts (476, 2023-09-18)
dist\src\components\__tests__ (0, 2023-09-18)
dist\src\components\__tests__\Credits.spec.d.ts (11, 2023-09-18)
dist\src\documentation (0, 2023-09-18)
dist\src\documentation\AccessingThePeaksInstance.vue.d.ts (341, 2023-09-18)
dist\src\documentation\AvailableProperties.vue.d.ts (341, 2023-09-18)
dist\src\documentation\Credits.vue.d.ts (341, 2023-09-18)
dist\src\documentation\DemoWidget.vue.d.ts (341, 2023-09-18)
... ...

# vue-peaks ![License](https://img.shields.io/github/license/suterma/vue-peaks.svg 'License') ![GitHub All Releases](https://img.shields.io/github/downloads/suterma/vue-peaks/total.svg 'GitHub All Releases') ![Release](https://img.shields.io/github/release/suterma/vue-peaks.svg 'Release') ![Language](https://img.shields.io/github/languages/top/suterma/vue-peaks.svg 'Language') ![npm](https://img.shields.io/npm/dm/vue-peaks 'NPM') [![](https://data.jsdelivr.com/v1/package/npm/vue-peaks/badge 'jsDelivr')](https://www.jsdelivr.com/package/npm/vue-peaks) [![Rate this package](https://badges.openbase.com/js/rating/vue-peaks.svg?token=vHkEYi5zzp1G84PyPGIiYYDN/9+SZtzXDlLAEe5ffRA=)](https://openbase.com/js/vue-peaks?utm_source=embedded&utm_medium=badge&utm_campaign=rate-badge) A lightweight Vue wrapper around the [bbc/peaks.js](https://github.com/bbc/peaks.js) audio waveform UI component. ![Image](https://github.com/suterma/vue-peaks/blob/main/vue-peaks-example-ui.png?raw=true) vue-peaks aims to simplify the use of [peaks.js](https://github.com/bbc/peaks.js/) in a [Vue3](https://vuejs.org/) environment. It provides a single component, `AudioPeaks`. Explore the [live examples](https://suterma.github.io/vue-peaks/). # Installation ```sh npm install vue-peaks --save ``` Installing vue-peaks also installs [peaks.js (version 3)](https://github.com/bbc/peaks.js/) as a dependency. Additionally, peaks.js uses [Konva (version 8 or 9)](https://konvajs.org/) and [waveform-data (version 4)](https://github.com/bbc/waveform-data.js) as peer dependencies; these will get installed with vue-peaks, if not already available. # How to use ## Basic examples vue-peaks provides three modes of operation: - **Simple mode**: just set the media URL, and all views are automatically rendered by default - **Slot mode**: the media element and additional views are provided using named slots - **External mode**: the media element and additional views are referenced by id or HTML element references Preferred: Import the compiled component: ``` import { AudioPeaks } from 'vue-peaks'; // default styles for the AudioPeaks component import 'vue-peaks/dist/style.css'; ``` Note: Even if you do not use the default (or any other) styles, the overview and zoomview panes still do have a small minimum size set. Alternative: The package does not currently properly export types, see issue [#17](https://github.com/suterma/vue-peaks/issues/17). To get TypeScript support, you can also directly include the vue component as SFC: ``` import AudioPeaks from 'vue-peaks/src/components/AudioPeaks.vue'; // default styles for the AudioPeaks component are already contained in the SFC ``` #### Simple mode By default, the [AudioPeaks Vue component](https://github.com/suterma/vue-peaks/blob/main/src/components/AudioPeaks.vue) template creates a new audio element, with the given source URL, and both view panes (overview and zoom, which are rendered with a default size) and a controls pane. A new audio context is created and used to compute the waveform. ``` ``` #### Slot mode To provide your own media element, just place it inside the `AudioPeaks` element (a.k.a. the slot). Vue-peaks will use the first media element in the slot. A new audio context is created and used to compute the waveform. ``` You can also add additional HTML content. ``` #### Using a specified media element ("external" mode) If you already have an existing media element, you can reference it by it's (unique) id, or as an HTMLMediaElement object. A new audio context is created and used to compute the waveform. There are also properties available for the overview area and the zoom view area. ```
Using the external media element above.
``` See a more [detailed documentation and live examples on the GitHub Pages](https://suterma.github.io/vue-peaks/). # Troubleshooting **Uncaught TypeError: Cannot read properties of null (reading 'isCE')** When you use Webpack and locally link to the vue-peaks library, make sure vue is not included twice. See https://github.com/vuejs/core/issues/4478#issuecomment-912235940 Your vue.config.js should look like ``` const { defineConfig } = require('@vue/cli-service') const path = require('path') //add module.exports = defineConfig({ transpileDependencies: true, chainWebpack(config) { config.resolve.symlinks(false) //add config.resolve.alias.set( 'vue', path.resolve('./node_modules/vue')) // add }, }) ``` # Build & Development ## Project Setup ```sh npm install ``` ### Compile and Hot-Reload for Development ```sh npm run dev ``` ### Compile and publish on GitHub pages ```sh # cleanup rm -rf dist npm run build # to publish to GitHub Pages (requires committing and pushing the build in the /dist folder) git add dist -f git commit -m 'built for gh-pages' git push npm run publish-gh-pages ``` ### Compile for Production an publish as Library - Update version - Update CHANGELOG.md - Disable the App mode and enable the [library mode](https://vitejs.dev/guide/build.html#library-mode) - in `vite.config.ts` - uncomment the `resolve` import - comment out the `rollupOptions` for the App Mode - uncomment the `lib` property and the subsequent `rollupOptions` for the Library Mode ```sh # cleanup rm -rf dist npm run build # to publish to npm npm publish ``` - Change back to App mode ### Run Unit Tests with [Vitest](https://vitest.dev/) ```sh npm run test:unit ``` # Credits - [peaks.js](https://github.com/bbc/peaks.js/), a client-side JavaScript component to display and interact with audio waveforms in the browser. (Released under the LGPL-3.0 license, by the British Broadcasting Corporation and contributors) - [Vue.js](https://vuejs.org/), the progressive JavaScript framework. (Released under the MIT License, Copyright 2014-2021 Evan You) - [Bulma](https://bulma.io/), the modern CSS framework that just works. (Released under the MIT License, by Jeremy Thomas) - [Bulmaswatch](https://jenil.github.io/bulmaswatch/), free themes for Bulma. (Released under the MIT License, by Jenil Gogari) - [Material Design Icons](https://materialdesignicons.com/), the original. Following Google's Material Design guidelines for system icons. (Icons released under the Apache 2.0 License, by pictogrammers.com) - [Jest](https://jestjs.io/), a delightful JavaScript Testing Framework. (Released under the MIT License, by Facebook) - Music from the Album "Not For Sale" by Lidija Roos (Released to the public, by Lidija Roos) - [@highlightjs/vue-plugin](https://github.com/highlightjs/vue-plugin), provides a highlightjs component for use in your Vue.js 3 applications. (Released under the BSD-3-Clause license, by the highlight.js team) - [@rushstack/eslint-patch](https://github.com/microsoft/rushstack/tree/main/eslint/eslint-patch), a patch that improves how ESLint loads plugins when working in a monorepo with a reusable toolchain. (Released under the MIT License, by Microsoft) - [@types/jsdom, @types/node](https://github.com/DefinitelyTyped/DefinitelyTyped), the repository for high quality TypeScript type definitions. (Released under the MIT License, by various contributors) - [vite, vitest, @vitejs/plugin-vue](https://github.com/vitejs/vite), next Generation Frontend Tooling. (Released under the MIT License, by the vite team) - [eslint](https://github.com/eslint/eslint), a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code. (Released under the MIT License, by the eslint team) - [jsdom](https://github.com/jsdom/jsdom), a pure-JavaScript implementation of many web standards. (Released under the MIT License, by the jsdom team) - [npm-run-all](https://github.com/mysticatea/npm-run-all), a CLI tool to run multiple npm-scripts in parallel or sequential. (Released under the MIT License, by Toru Nagashima) - [prettier](https://github.com/prettier/prettier), an opinionated Code Formatter. (Released under the MIT License, by the prettier team) - [typescript](https://github.com/Microsoft/TypeScript), a language for application-scale JavaScript. (Released under the Apache-2.0 license, by Microsoft) - [vue-tsc](https://github.com/johnsoncodehk/volar), high-performance tooling for Vue. (Released under the MIT License, by Johnson Chu) - Post [Making and publishing components with Vue 3 and Vite](https://dev.to/matijanovosel/making-and-distributing-a-ui-component-with-vue-3-and-vite-12lk) by [Matija Novosel](https://www.matijanovosel.com/). Initial code is taken from - [peaks-vue-demo](https://github.com/candeogi/peaks-vue-demo) by Giovanni Candeo (MIT-licensed) - [vue-waveform-template](https://github.com/thom4parisot/vue-waveform-template) by Thomas Parisot (MIT-licensed) --- [vue-peaks](https://github.com/suterma/vue-peaks) is created with love by [Marcel Suter](https://marcelsuter.ch) for the [Replayer](https://replayer.app) project.

近期下载者

相关文件


收藏者