1.0.8 • Published 2 years ago

@uni/video v1.0.8

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
2 years ago

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

PropertyTypeDescriptionrequiredDefault
optionsobject -
options.sourceTypeArray<string> The source of the video'album', 'camera'
options.maxDurationnumberThe maximum duration of a recorded video60
options.successFunction The callback function for a successful API call-
options.failFunction The callback function for a failed API call-
options.completeFunction The callback function used when the API call completed (always executed whether the call succeeds or fails)-

Special Arguments

PropertyTypeDescriptionrequiredDefaultSupported
options.camerastring Indicates the default camera to be enabled. can be 'back' or 'front''back'
options.compressedboolean Indicates whether to compress the selected video filetrue

Return

PropertyTypeDescription
tempFilePathstring Temporary file path of the selected video
durationnumberDuration of the selected video
sizenumberAmount of data of the selected video
widthnumberReturns the height of the selected video
heightnumberReturns 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

PropertyTypeDescriptionrequiredDefault
idstring The video components ID-
contextobject The this object of the current component instance in custom components. It is used with the video component(only for wechat and bytedance)-

Return

PropertyTypeDescription
videoContextVideoContextVideoContext is bound to an video component with an id, to work with the video component.
1.0.8

2 years ago

1.0.8-beta.0

2 years ago

1.0.7

2 years ago

1.0.6

4 years ago

1.0.5-beta

4 years ago

1.0.5

4 years ago

1.0.5-beta1

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

1.0.0-beta1

4 years ago

1.0.0-beta

4 years ago