forked from Techsystech/web
[MIG] web_widget_image_webcam from v13 to v14
Update webcam.js from 1.0.25 to 1.0.26 Fix URLs in readme/CONFIGURE.rst Minor pre-commit reformatting in JS code16.0
parent
689c5df032
commit
bcd74f10bb
|
@ -4,7 +4,7 @@
|
|||
{
|
||||
"name": "Web Widget - Image WebCam",
|
||||
"summary": "Allows to take image with WebCam",
|
||||
"version": "13.0.1.0.0",
|
||||
"version": "14.0.1.0.0",
|
||||
"category": "web",
|
||||
"website": "https://github.com/OCA/web",
|
||||
"author": "Tech Receptives, "
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
By default, the module works with all `major browsers
|
||||
<https://github.com/jhuckaby/webcamjs#browser-support>`_.
|
||||
<https://github.com/jhuckaby/webcamjs/blob/master/DOCS.md#browser-support>`_.
|
||||
|
||||
An important note for **Chrome 47+** users - this module only works with websites delivered over SSL / HTTPS.
|
||||
Visit this for `more info
|
||||
<https://github.com/jhuckaby/webcamjs#important-note-for-chrome-47>`_.
|
||||
<https://github.com/jhuckaby/webcamjs/blob/master/DOCS.md#important-note-for-chrome-47>`_.
|
||||
|
||||
But, If you still want this module to work with websites without SSL / HTTPS.
|
||||
Here is the steps to do it easily (Always run in Adobe Flash fallback mode, but it is not desirable).
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Copyright 2016 Siddharth Bhalgami <siddharth.bhalgami@gmail.com>
|
||||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
||||
*/
|
||||
odoo.define("web_widget_image_webcam.webcam_widget", function(require) {
|
||||
odoo.define("web_widget_image_webcam.webcam_widget", function (require) {
|
||||
"use strict";
|
||||
|
||||
var core = require("web.core");
|
||||
|
@ -14,7 +14,7 @@ odoo.define("web_widget_image_webcam.webcam_widget", function(require) {
|
|||
var QWeb = core.qweb;
|
||||
|
||||
FieldBinaryImage.include({
|
||||
_render: function() {
|
||||
_render: function () {
|
||||
this._super();
|
||||
|
||||
var self = this,
|
||||
|
@ -38,7 +38,7 @@ odoo.define("web_widget_image_webcam.webcam_widget", function(require) {
|
|||
rpc.query({
|
||||
model: "ir.config_parameter",
|
||||
method: "get_webcam_flash_fallback_mode_config",
|
||||
}).then(function(default_flash_fallback_mode) {
|
||||
}).then(function (default_flash_fallback_mode) {
|
||||
if (default_flash_fallback_mode == 1) {
|
||||
Webcam.set({
|
||||
/*
|
||||
|
@ -53,7 +53,7 @@ odoo.define("web_widget_image_webcam.webcam_widget", function(require) {
|
|||
self.$el
|
||||
.find(".o_form_binary_file_web_cam")
|
||||
.off()
|
||||
.on("click", function() {
|
||||
.on("click", function () {
|
||||
// Init Webcam
|
||||
var dialog = new Dialog(self, {
|
||||
size: "large",
|
||||
|
@ -64,8 +64,8 @@ odoo.define("web_widget_image_webcam.webcam_widget", function(require) {
|
|||
{
|
||||
text: _t("Take Snapshot"),
|
||||
classes: "btn-primary take_snap_btn",
|
||||
click: function() {
|
||||
Webcam.snap(function(data) {
|
||||
click: function () {
|
||||
Webcam.snap(function (data) {
|
||||
img_data = data;
|
||||
// Display Snap besides Live WebCam Preview
|
||||
WebCamDialog.find("#webcam_result").html(
|
||||
|
@ -82,7 +82,7 @@ odoo.define("web_widget_image_webcam.webcam_widget", function(require) {
|
|||
text: _t("Save & Close"),
|
||||
classes: "btn-primary save_close_btn",
|
||||
close: true,
|
||||
click: function() {
|
||||
click: function () {
|
||||
var img_data_base64 = img_data.split(",")[1];
|
||||
|
||||
/*
|
||||
|
@ -119,7 +119,7 @@ odoo.define("web_widget_image_webcam.webcam_widget", function(require) {
|
|||
],
|
||||
}).open();
|
||||
|
||||
dialog.opened().then(function() {
|
||||
dialog.opened().then(function () {
|
||||
Webcam.attach("#live_webcam");
|
||||
|
||||
// At time of Init "Save & Close" button is disabled
|
||||
|
@ -135,7 +135,7 @@ odoo.define("web_widget_image_webcam.webcam_widget", function(require) {
|
|||
});
|
||||
|
||||
Dialog.include({
|
||||
destroy: function() {
|
||||
destroy: function () {
|
||||
// Shut Down the Live Camera Preview | Reset the System
|
||||
Webcam.reset();
|
||||
this._super.apply(this, arguments);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// WebcamJS v1.0.25
|
||||
// WebcamJS v1.0.26
|
||||
// Webcam library for capturing JPEG/PNG images in JavaScript
|
||||
// Attempts getUserMedia, falls back to Flash
|
||||
// Author: Joseph Huckaby: http://github.com/jhuckaby
|
||||
// Based on JPEGCam: http://code.google.com/p/jpegcam/
|
||||
// Copyright (c) 2012 - 2017 Joseph Huckaby
|
||||
// Copyright (c) 2012 - 2019 Joseph Huckaby
|
||||
// Licensed under the MIT License
|
||||
|
||||
(function(window) {
|
||||
|
@ -34,7 +34,7 @@ FlashError.prototype = new IntermediateInheritor();
|
|||
WebcamError.prototype = new IntermediateInheritor();
|
||||
|
||||
var Webcam = {
|
||||
version: '1.0.25',
|
||||
version: '1.0.26',
|
||||
|
||||
// globals
|
||||
protocol: location.protocol.match(/https/i) ? 'https' : 'http',
|
||||
|
@ -92,10 +92,6 @@ var Webcam = {
|
|||
window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL;
|
||||
this.userMedia = this.userMedia && !!this.mediaDevices && !!window.URL;
|
||||
|
||||
if (this.iOS) {
|
||||
this.userMedia = null;
|
||||
}
|
||||
|
||||
// Older versions of firefox (< 21) apparently claim support but user media does not actually work
|
||||
if (navigator.userAgent.match(/Firefox\D+(\d+)/)) {
|
||||
if (parseInt(RegExp.$1, 10) < 21) this.userMedia = null;
|
||||
|
@ -274,6 +270,7 @@ var Webcam = {
|
|||
// setup webcam video container
|
||||
var video = document.createElement('video');
|
||||
video.setAttribute('autoplay', 'autoplay');
|
||||
video.setAttribute('playsinline', 'playsinline');
|
||||
video.style.width = '' + this.params.dest_width + 'px';
|
||||
video.style.height = '' + this.params.dest_height + 'px';
|
||||
|
||||
|
|
Loading…
Reference in New Issue