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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@uni/video

v1.0.8

Published

[![npm](https://img.shields.io/npm/v/@uni/video.svg)](https://www.npmjs.com/package/@uni/video)

Downloads

2,309

Readme

chooseVideo

npm

Takes a video or selects a video from the mobile album.

Supported

Install

$ npm install @uni/video --save

or

$ npm install @uni/apis --save

Usage

import { chooseVideo } from '@uni/video';

chooseVideo({
  sourceType: ['album', 'camera'],
  compressed: true,
  camera: 'back',
  maxDuration: 100,
  success (res) {
    console.log(res);
  }
});

// promise
chooseVideo({
  sourceType: ['camera'],
  compressed: false,
  camera: 'front',
  maxDuration: 20,
}).then(res => {
  console.log(res);
});

You can also import from the big package:

import { video } from '@uni/apis';

video.chooseVideo({
  sourceType: ['album', 'camera'],
  compressed: true,
  camera: 'back',
  maxDuration: 100,
  success (res) {
    console.log(res);
  }
});

// promise
video.chooseVideo({
  sourceType: ['camera'],
  compressed: false,
  camera: 'front',
  maxDuration: 20,
}).then(res => {
  console.log(res);
});

Methods

chooseVideo(options)

Arguments

| Property | Type | Description | required | Default | | --- | --- | --- | --- | --- | | options | object  | | ✘ | - | | options.sourceType | Array<string>  | The source of the video | ✘ | ['album', 'camera'] | | options.maxDuration | number | The maximum duration of a recorded video | ✘ | 60 | | options.success | Function  | The callback function for a successful API call | ✘ | - | | options.fail | Function  | The callback function for a failed API call | ✘ | - | | options.complete | Function  | The callback function used when the API call completed (always executed whether the call succeeds or fails) | ✘ | - |

Special Arguments

| Property | Type | Description | required | Default | Supported | | --- | --- | --- | --- | --- | -- | | options.camera | string  | Indicates the default camera to be enabled. can be 'back' or 'front' | ✘ | 'back' | | | options.compressed | boolean  | Indicates whether to compress the selected video file | ✘ | true | |

Return

| Property | Type | Description | | --- | --- | --- | | tempFilePath | string  | Temporary file path of the selected video | | duration | number | Duration of the selected video | | size | number | Amount of data of the selected video | | width | number | Returns the height of the selected video | | height | number | Returns the width of the selected video |

createVideoContext

npm

Creates the VideoContext object for the video.

Supported

Install

$ npm install @uni/video --save

or

$ npm install @uni/apis --save

Usage

import { createVideoContext } from '@uni/video';

const videoContext = createVideoContext('videoId');

You can also import from the big package:

import { video } from '@uni/apis';

const videoContext = video.createVideoContext('videoId');

Methods

createVideoContext(id, context)

Arguments

| Property | Type | Description | required | Default | | --- | --- | --- | --- | --- | | id | string  | The video components ID | ✔ | - | | context | object  | The this object of the current component instance in custom components. It is used with the video component(only for wechat and bytedance) | ✘ | - |

Return

| Property | Type | Description | | --- | --- | --- | | videoContext | VideoContext | VideoContext is bound to an video component with an id, to work with the video component. |