├── .babelrc
├── .editorconfig
├── .eslintrc.json
├── .gitignore
├── LICENSE
├── README.md
├── assets
├── logo.png
└── splash.png
├── build
└── webpack.config.js
├── demo
├── src
│ ├── main.js
│ └── main.vue
└── webpack.config.js
├── dist
└── index.js
├── index.html
├── nuxt
├── index.js
└── plugin.js
├── package.json
├── src
├── index.js
└── webcam.vue
└── yarn.lock
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [["@babel/preset-env", { "modules": false }]],
3 | "plugins": [
4 | "@babel/plugin-syntax-dynamic-import",
5 | "@babel/plugin-transform-runtime",
6 | "@babel/plugin-transform-object-assign",
7 | "@babel/plugin-proposal-object-rest-spread"
8 | ]
9 | }
10 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "browser": true,
4 | "commonjs": true,
5 | "es6": true,
6 | "node": true
7 | },
8 | "extends": [
9 | "eslint:recommended",
10 | "plugin:vue/recommended",
11 | "plugin:import/errors",
12 | "plugin:import/warnings"
13 | ],
14 | "parserOptions": {
15 | "parser": "babel-eslint",
16 | "ecmaFeatures": {
17 | "jsx": true
18 | },
19 | "ecmaVersion": 2017,
20 | "sourceType": "module"
21 | },
22 | "plugins": ["vue", "prettier"],
23 | "rules": {
24 | "no-const-assign": "warn",
25 | "no-this-before-super": "warn",
26 | "no-undef": "warn",
27 | "no-unreachable": "warn",
28 | "no-unused-vars": "off",
29 | "constructor-super": "warn",
30 | "valid-typeof": "warn",
31 | "import/no-unresolved": "off",
32 | "import/no-unassigned-import": "warn",
33 | "semi": 0,
34 | "no-console": "off",
35 | "prettier/prettier": "error",
36 | "vue/max-attributes-per-line": [
37 | 2,
38 | {
39 | "singleline": 2,
40 | "multiline": {
41 | "max": 1,
42 | "allowFirstLine": true
43 | }
44 | }
45 | ]
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | demo/
2 | .DS_Store
3 | node_modules/
4 | npm-debug.log
5 | yarn-error.log
6 | package-lock.json
7 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Vincent Gabriel
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | # vue-web-cam
10 |
11 | [](https://www.npmjs.com/package/vue-web-cam)
12 | [](https://www.npmjs.com/package/vue-web-cam)
13 | 
14 | [](https://opensource.org/licenses/MIT)
15 |
16 | Webcam component for VueJs. See [this](http://caniuse.com/#feat=stream)
17 | for browser compatibility.
18 |
19 | ## Installation
20 |
21 | ```bash
22 | npm install vue-web-cam --save
23 | // or
24 | yarn add vue-web-cam
25 | ```
26 |
27 | ## Usage
28 |
29 | ```js
30 | import Vue from 'vue'
31 | import WebCam from "../../src";
32 | Vue.use(WebCam);
33 |
34 |
35 |
36 |
37 | // or
38 | import { WebCam } from "vue-web-cam";
39 |
40 | components: {
41 | WebCam
42 | }
43 |
44 |
45 |
46 | components: {
47 | 'vue-web-cam': WebCam
48 | }
49 |
50 |
51 | ```
52 |
53 | ## Nuxt.js
54 |
55 | Add `vue-web-cam/nuxt` to modules section of `nuxt.config.js`
56 |
57 | ```javascript
58 | {
59 | modules: ['vue-web-cam/nuxt']
60 | }
61 | ```
62 |
63 | ## Testing & Dev
64 |
65 | ```bash
66 | npm run dev
67 | ```
68 |
69 | ### Props
70 |
71 | | prop | type | default | notes |
72 | | ----------------- | ------- | ------------ | -------------------------------------------------- |
73 | | height | number | 500 | height of video element |
74 | | width | number | 500 | width of video element |
75 | | autoplay | boolean | true | autoplay attribute |
76 | | screenshotFormat | string | 'image/jpeg' | format of screenshot |
77 | | selectFirstDevice | boolean | false | select first device when avaialble |
78 | | deviceId | string | null | currently selected camera |
79 | | playsinline | boolean | true | playsinline of video element |
80 | | resolution | object | null | object with width and height for camera resolution |
81 |
82 | ### Events
83 |
84 | | name | param | notes |
85 | | ------------- | -------- | ------------------------------------------------------------- |
86 | | started | stream | emitted once the stream has started |
87 | | stopped | stream | emitted once the stream has stopped |
88 | | error | error | emitted if the stream failed to start with the error returned |
89 | | notsupported | error | emitted when the browser does not support this feature |
90 | | cameras | cameras | emitted when a list of all cameras available is loaded |
91 | | camera-change | deviceId | emitted when camera change occurs |
92 | | video-live | stream | emitted when video is started |
93 |
94 | ### Methods
95 |
96 | | name | param | notes |
97 | | ------------ | -------- | ----------------------------------------------------------------------------------------------------- |
98 | | capture | void | Capture the current image through the webcam as a base64 encoded dataUri |
99 | | changeCamera | deviceId | change the currently selected camera. Must pass in the device ID |
100 | | start | void | Programmatically Start the camera after stopping it (relies on deviceId prop passed to the component) |
101 | | stop | void | Programmatically stop the camera |
102 | | pause | void | Programmatically pause the camera |
103 | | resume | void | Programmatically resume the camera after it was paused |
104 |
105 | ## Contributing
106 |
107 | If you'd like to help make this project better you can help with the following tasks:
108 |
109 | - Tests - This project needs a way to test the functionality using a javascript testing solution (Jest as an example)
110 | - Examples - Additional Examples of usage might be helpful to others.
111 | - Project Website - Perhaps launch a project website (on Github Pages) that'll showcase the plugin, Demo, Usage instructions, configuration etc..
112 |
113 | ## License
114 |
115 | MIT
116 |
117 | ## Credits
118 |
119 | This is based off [@smronju vue-webcam](https://github.com/smronju/vue-webcam) and [react-webcam](https://github.com/mozmorris/react-webcam)
120 |
--------------------------------------------------------------------------------
/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VinceG/vue-web-cam/74475f65741b9ced2479a75a0bf9bc35adb01743/assets/logo.png
--------------------------------------------------------------------------------
/assets/splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VinceG/vue-web-cam/74475f65741b9ced2479a75a0bf9bc35adb01743/assets/splash.png
--------------------------------------------------------------------------------
/build/webpack.config.js:
--------------------------------------------------------------------------------
1 | var path = require("path");
2 | var webpack = require("webpack");
3 | const VueLoaderPlugin = require("vue-loader/lib/plugin");
4 | const { version } = require("../package.json");
5 |
6 | module.exports = {
7 | mode: "production",
8 | entry: "./src/index.js",
9 | output: {
10 | path: path.resolve(__dirname, "../dist"),
11 | publicPath: "/dist/",
12 | filename: "index.js",
13 | library: "vue-web-cam",
14 | libraryTarget: "umd"
15 | },
16 | module: {
17 | rules: [
18 | {
19 | test: /\.vue$/,
20 | loader: "vue-loader",
21 | options: {
22 | loaders: {
23 | scss: "vue-style-loader!css-loader!sass-loader",
24 | sass: "vue-style-loader!css-loader!sass-loader?indentedSyntax"
25 | }
26 | }
27 | },
28 | {
29 | test: /\.js$/,
30 | loader: "babel-loader",
31 | exclude: /node_modules/
32 | }
33 | ]
34 | },
35 | externals: {
36 | vue: "vue"
37 | },
38 | resolve: {
39 | extensions: [".js", ".vue"],
40 | alias: {
41 | vue: "vue/dist/vue.esm.js"
42 | }
43 | },
44 | devServer: {
45 | historyApiFallback: true,
46 | noInfo: true
47 | },
48 | performance: {
49 | hints: false
50 | },
51 | plugins: [
52 | new VueLoaderPlugin(),
53 | new webpack.DefinePlugin({
54 | __VERSION__: JSON.stringify(version),
55 | "process.env": {
56 | NODE_ENV: '"production"'
57 | }
58 | }),
59 | new webpack.LoaderOptionsPlugin({
60 | minimize: true
61 | })
62 | ]
63 | };
64 |
--------------------------------------------------------------------------------
/demo/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from "vue";
2 | import App from "./main.vue";
3 |
4 | // import WebCam from "../../src";
5 | // Vue.use(WebCam);
6 |
7 | new Vue({
8 | el: "#app",
9 | render: h => h(App)
10 | });
11 |
--------------------------------------------------------------------------------
/demo/src/main.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
Current Camera
6 |
{{ device.label }}
7 |
8 |
18 |
19 |
20 |
21 |
22 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
Captured Image
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
113 |
--------------------------------------------------------------------------------
/demo/webpack.config.js:
--------------------------------------------------------------------------------
1 | var path = require("path");
2 | var webpack = require("webpack");
3 | var HtmlWebpackPlugin = require("html-webpack-plugin");
4 | const VueLoaderPlugin = require("vue-loader/lib/plugin");
5 | const { version } = require("../package.json");
6 |
7 | module.exports = {
8 | mode: "development",
9 | entry: "./demo/src/main.js",
10 | output: {
11 | path: path.resolve(__dirname, "./dist"),
12 | publicPath: "/",
13 | filename: "build.js"
14 | },
15 | module: {
16 | rules: [
17 | {
18 | test: /\.vue$/,
19 | loader: "vue-loader",
20 | options: {
21 | loaders: {
22 | // Since sass-loader (weirdly) has SCSS as its default parse mode, we map
23 | // the "scss" and "sass" values for the lang attribute to the right configs here.
24 | // other preprocessors should work out of the box, no loader config like this necessary.
25 | scss: "vue-style-loader!css-loader!sass-loader",
26 | sass: "vue-style-loader!css-loader!sass-loader?indentedSyntax"
27 | }
28 | // other vue-loader options go here
29 | }
30 | },
31 | {
32 | test: /\.js$/,
33 | loader: "babel-loader",
34 | exclude: /node_modules/
35 | },
36 | {
37 | test: /\.(png|jpg|gif|svg)$/,
38 | loader: "file-loader",
39 | options: {
40 | name: "[name].[ext]?[hash]"
41 | }
42 | }
43 | ]
44 | },
45 | resolve: {
46 | extensions: [".js", ".vue"],
47 | alias: {
48 | vue: "vue/dist/vue.esm.js",
49 | plugin: path.resolve(__dirname, "../dist/build.js")
50 | }
51 | },
52 | devServer: {
53 | historyApiFallback: true
54 | },
55 | performance: {
56 | hints: false
57 | },
58 | devtool: "#eval-source-map",
59 | plugins: [
60 | new VueLoaderPlugin(),
61 | new webpack.DefinePlugin({
62 | __VERSION__: JSON.stringify(version),
63 | "process.env": "'development'"
64 | }),
65 | new webpack.HotModuleReplacementPlugin(),
66 | new webpack.NoEmitOnErrorsPlugin(),
67 | new HtmlWebpackPlugin({
68 | filename: "index.html",
69 | template: "index.html",
70 | inject: true
71 | })
72 | ]
73 | };
74 |
75 | if (process.env.NODE_ENV === "production") {
76 | // http://vue-loader.vuejs.org/en/workflow/production.html
77 | module.exports.plugins = (module.exports.plugins || []).concat([
78 | new webpack.DefinePlugin({
79 | __VERSION__: JSON.stringify(version),
80 | "process.env": {
81 | NODE_ENV: '"production"'
82 | }
83 | }),
84 | new webpack.LoaderOptionsPlugin({
85 | minimize: true
86 | })
87 | ]);
88 | }
89 |
--------------------------------------------------------------------------------
/dist/index.js:
--------------------------------------------------------------------------------
1 | !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["vue-web-cam"]=t():e["vue-web-cam"]=t()}(window,function(){return function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/dist/",i(i.s=0)}([function(e,t,i){"use strict";i.r(t);var n=function(e,t,i,n,r,o,a,s){var c,d="function"==typeof e?e.options:e;if(t&&(d.render=t,d.staticRenderFns=i,d._compiled=!0),n&&(d.functional=!0),o&&(d._scopeId="data-v-"+o),a?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),r&&r.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},d._ssrRegister=c):r&&(c=s?function(){r.call(this,this.$root.$options.shadowRoot)}:r),c)if(d.functional){d._injectStyles=c;var u=d.render;d.render=function(e,t){return c.call(t),u(e,t)}}else{var f=d.beforeCreate;d.beforeCreate=f?[].concat(f,c):[c]}return{exports:e,options:d}}({name:"VueWebCam",props:{width:{type:[Number,String],default:"100%"},height:{type:[Number,String],default:500},autoplay:{type:Boolean,default:!0},screenshotFormat:{type:String,default:"image/jpeg"},selectFirstDevice:{type:Boolean,default:!1},deviceId:{type:String,default:null},playsinline:{type:Boolean,default:!0},resolution:{type:Object,default:null,validator:function(e){return e.height&&e.width}}},data:function(){return{source:null,canvas:null,camerasListEmitted:!1,cameras:[]}},watch:{deviceId:function(e){this.changeCamera(e)}},mounted:function(){this.setupMedia()},beforeDestroy:function(){this.stop()},methods:{legacyGetUserMediaSupport:function(){return function(e){var t=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia||navigator.oGetUserMedia;return t?new Promise(function(i,n){t.call(navigator,e,i,n)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}},setupMedia:function(){void 0===navigator.mediaDevices&&(navigator.mediaDevices={}),void 0===navigator.mediaDevices.getUserMedia&&(navigator.mediaDevices.getUserMedia=this.legacyGetUserMediaSupport()),this.testMediaAccess()},loadCameras:function(){var e=this;navigator.mediaDevices.enumerateDevices().then(function(t){for(var i=0;i!==t.length;++i){var n=t[i];"videoinput"===n.kind&&e.cameras.push(n)}}).then(function(){e.camerasListEmitted||(e.selectFirstDevice&&e.cameras.length>0&&(e.deviceId=e.cameras[0].deviceId),e.$emit("cameras",e.cameras),e.camerasListEmitted=!0)}).catch(function(t){return e.$emit("notsupported",t)})},changeCamera:function(e){this.stop(),this.$emit("camera-change",e),this.loadCamera(e)},loadSrcStream:function(e){var t=this;"srcObject"in this.$refs.video?this.$refs.video.srcObject=e:this.source=window.HTMLMediaElement.srcObject(e),this.$refs.video.onloadedmetadata=function(){t.$emit("video-live",e)},this.$emit("started",e)},stopStreamedVideo:function(e){var t=this,i=e.srcObject;i.getTracks().forEach(function(e){e.stop(),t.$emit("stopped",i),t.$refs.video.srcObject=null,t.source=null})},stop:function(){null!==this.$refs.video&&this.$refs.video.srcObject&&this.stopStreamedVideo(this.$refs.video)},start:function(){this.deviceId&&this.loadCamera(this.deviceId)},pause:function(){null!==this.$refs.video&&this.$refs.video.srcObject&&this.$refs.video.pause()},resume:function(){null!==this.$refs.video&&this.$refs.video.srcObject&&this.$refs.video.play()},testMediaAccess:function(){var e=this,t={video:!0};this.resolution&&(t.video={},t.video.height=this.resolution.height,t.video.width=this.resolution.width),navigator.mediaDevices.getUserMedia(t).then(function(t){t.getTracks().forEach(function(e){e.stop()}),e.loadCameras()}).catch(function(t){return e.$emit("error",t)})},loadCamera:function(e){var t=this,i={video:{deviceId:{exact:e}}};this.resolution&&(i.video.height=this.resolution.height,i.video.width=this.resolution.width),navigator.mediaDevices.getUserMedia(i).then(function(e){return t.loadSrcStream(e)}).catch(function(e){return t.$emit("error",e)})},capture:function(){return this.getCanvas().toDataURL(this.screenshotFormat)},getCanvas:function(){var e=this.$refs.video;if(!this.ctx){var t=document.createElement("canvas");t.height=e.videoHeight,t.width=e.videoWidth,this.canvas=t,this.ctx=t.getContext("2d")}var i=this.ctx,n=this.canvas;return i.drawImage(e,0,0,n.width,n.height),n}}},function(){var e=this.$createElement;return(this._self._c||e)("video",{ref:"video",attrs:{width:this.width,height:this.height,src:this.source,autoplay:this.autoplay,playsinline:this.playsinline}})},[],!1,null,null,null).exports;function r(e){e.component("vue-web-cam",n)}i.d(t,"version",function(){return o}),i.d(t,"WebCam",function(){return n}),"undefined"!=typeof window&&window.Vue&&window.Vue.use(r);t.default=r;var o="__VERSION__"}])});
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Vue Web Cam
6 |
12 |
13 |
14 |
28 |
29 |
30 |
31 |
32 |
33 |
38 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/nuxt/index.js:
--------------------------------------------------------------------------------
1 | const { resolve } = require('path')
2 |
3 | module.exports = function nuxtVueWebCam() {
4 | this.addPlugin({
5 | ssr: false,
6 | src: resolve(__dirname, 'plugin.js'),
7 | fileName: 'vue-web-cam.js'
8 | })
9 | }
10 |
11 | module.exports.meta = require('../package.json')
12 |
--------------------------------------------------------------------------------
/nuxt/plugin.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import VueWebCam from "vue-web-cam";
3 |
4 | Vue.use(VueWebCam)
5 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-web-cam",
3 | "version": "1.9.0",
4 | "description": "Webcam component for Vuejs applications",
5 | "repository": {
6 | "type": "git",
7 | "url": "https://github.com/vinceg/vue-web-cam"
8 | },
9 | "license": "MIT",
10 | "author": {
11 | "name": "Vincent Gabriel",
12 | "email": "vadimg88@gmail.com",
13 | "url": "https://github.com/vinceg"
14 | },
15 | "files": [
16 | "dist",
17 | "nuxt"
18 | ],
19 | "main": "dist/index.js",
20 | "scripts": {
21 | "build": "cross-env NODE_ENV=production webpack --progress --hide-modules --config build/webpack.config.js",
22 | "demo": "cross-env NODE_ENV=production webpack --progress --hide-modules --config demo/webpack.config.js",
23 | "dev": "cross-env NODE_ENV=development webpack-dev-server --hot --config demo/webpack.config.js"
24 | },
25 | "dependencies": {
26 | "vue": "^2.6.10"
27 | },
28 | "devDependencies": {
29 | "@babel/cli": "^7.2.3",
30 | "@babel/core": "^7.2.2",
31 | "@babel/plugin-proposal-class-properties": "^7.0.0",
32 | "@babel/plugin-proposal-decorators": "^7.0.0",
33 | "@babel/plugin-proposal-export-namespace-from": "^7.0.0",
34 | "@babel/plugin-proposal-function-sent": "^7.0.0",
35 | "@babel/plugin-proposal-json-strings": "^7.0.0",
36 | "@babel/plugin-proposal-numeric-separator": "^7.0.0",
37 | "@babel/plugin-proposal-object-rest-spread": "^7.2.0",
38 | "@babel/plugin-proposal-throw-expressions": "^7.0.0",
39 | "@babel/plugin-syntax-dynamic-import": "^7.0.0",
40 | "@babel/plugin-syntax-import-meta": "^7.0.0",
41 | "@babel/plugin-transform-object-assign": "^7.2.0",
42 | "@babel/plugin-transform-runtime": "^7.2.0",
43 | "@babel/polyfill": "^7.2.5",
44 | "@babel/preset-env": "^7.2.3",
45 | "@babel/runtime": "^7.2.0",
46 | "babel-eslint": "^10.0.1",
47 | "babel-loader": "^8.0.5",
48 | "cross-env": "^5.1",
49 | "css-loader": "^0.25.0",
50 | "eslint": "^5.8.0",
51 | "eslint-plugin-import": "^2.14.0",
52 | "eslint-plugin-prettier": "^3.0.0",
53 | "eslint-plugin-vue": "^4.7.1",
54 | "extract-text-webpack-plugin": "^3.0",
55 | "file-loader": "^0.9.0",
56 | "function-bind": "^1.0.2",
57 | "html-webpack-plugin": "3.2.0",
58 | "lodash": "^4.17.13",
59 | "mixin-deep": "^2.0.1",
60 | "set-value": "^2.0.1",
61 | "vue-loader": "^15.0.0",
62 | "vue-style-loader": "^4.1.2",
63 | "vue-template-compiler": "^2.5.7",
64 | "webpack": "4.28.4",
65 | "webpack-cli": "^3.2.1",
66 | "webpack-dev-server": ">=3.1.11",
67 | "webpack-merge": "^0.14.1"
68 | },
69 | "engines": {
70 | "node": ">= 8.10.0"
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import WebCam from "./webcam";
2 |
3 | function plugin(Vue) {
4 | Vue.component("vue-web-cam", WebCam);
5 | }
6 |
7 | // Install by default if using the script tag
8 | if (typeof window !== "undefined" && window.Vue) {
9 | window.Vue.use(plugin);
10 | }
11 |
12 | export default plugin;
13 | const version = "__VERSION__";
14 | // Export all components too
15 | export { WebCam, version };
16 |
--------------------------------------------------------------------------------
/src/webcam.vue:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
292 |
--------------------------------------------------------------------------------