Loading...
Copy code
Close
Permalink
Close
Please tell us why you want to mark the subject as inappropriate.
(Maximum 200 characters)
Report Inappropriate
Cancel
Private Message
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Cancel
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Update
Cancel
Feedback
Email ID
Subject :
Comments :
Send
Cancel
Private Message
Type the characters you see in the picture below.
Type the characters you see in the picture below.
Attach files
Desktop
Google Docs
Each Attachment size should not exceed 1.0 MB.
Max no of attachments : 3
Loading User Profile...
guest
Response title
This is preview!
Attachments
Publish
Back to edit
Cancel
(
)
Sign In
New to this Portal? Click here to
Sign up
You can also use the below options to login
Login with Facebook
Login with Google
Login with Yahoo
jQuery
Plugins
UI
Meetups
Forum
Blog
About
Donate
All Forums
Recent Posts
Log In
Search
jQuery
Search
jQuery Forum
Move this topic
Forum :
Getting Started
Using jQuery
Using jQuery Plugins
Using jQuery UI
Developing jQuery Core
Developing jQuery Plugins
Developing jQuery UI
QUnit and Testing
About the jQuery Forum
jQuery Conferences
jQuery Mobile
Developing jQuery Mobile
Sub forum :
Move this topic
Cancel
Developing jQuery Plugins
Jasman Ih..
Problem Call ExternalInterface flash function
in
Developing jQuery Plugins
•
9 years ago
I made a plugin webcam, I can not make a function call ExternalInterface flash in my plugin.
is there someone who wants to help :),
The
function work
when not
in
the
plugin
.
$("#webcam").get(0).actionSelfie("getCapture");
but I want make it on plugin like this:
this.Capture = function() {
if (opt.flash == true) {
//this my problem
camSelector.actionSelfie("getCapture");
} else {
}
}
error message: actionSelfie is not a function,,
function may be called, before the flash is loaded.
I am really newbie using jquery: '(
The following is the full code,,
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="content-type" content="text/html" />
<meta name="author" content="Jasman" />
<title>Untitled 3</title>
<script src="js/swfobject.js"></script>
<script src="js/jquery.js"></script>
<script src="js/selfie.js"></script>
<script type="text/javascript">
function show_img(image){
$("#result").html('<img src="' + image +'" width="320" height="240" style="border: 1px solid red"/>');
}
//for flash
function getMessages(label) {
$("#progress").html(label);
};
function getSnapshot(image) {
show_img(image)
};
$(document).ready(function(){
var MyCam = $("#webcam").Webcam({width: 320,height: 240}) ;
$("#CaptureBtn").click(function(){
//HTML5
//var img = MyCam.Capture();
//show_img(img);
// I need run like this var img = MyCam.Capture();
$("#webcam").get(0).actionSelfie("getCapture");
});
});
</script>
</head>
<body>
<label id="progress"></label>
<video id="webcam"></video>
<div id="result"></div>
<input type="button" id="CaptureBtn" value="Capture" />
</body>
</html>
My plugin
if (!jQuery) {
throw new Error("requires jQuery")
}
if (!jQuery) {
throw new Error("requires swfobject")
}
(function(dev) {
dev.fn.Webcam = function(options) {
var default_options = {
width: 320,
height: 240
};
var opt = dev.extend({}, default_options, options);
var ua = navigator.userAgent;
ua = ua.toLowerCase();
var uaMatch = /(chrome)[ \/]([\w.]+)/.exec(ua) || /(webkit)[ \/]([\w.]+)/.exec(ua) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || [];
//var useFlash = false;
var useFlash = true; //only test flash
if (uaMatch[1] == "msie") {
useFlash = true
}
if (uaMatch[1] == "mozilla" && parseFloat(uaMatch[2]) <= 17) {
useFlash = true
}
if (uaMatch[1] == "webkit" && parseFloat(uaMatch[2]) <= 21) {
useFlash = true
}
if (uaMatch[1] == "opera" && parseFloat(uaMatch[2]) <= 18) {
useFlash = true
}
var flash_dir = "";
$("script").each(function() {
var e = /(selfie)/.exec(this.src);
if (e) {
flash_dir = this.src
}
});
var flash_dir = flash_dir.replace(".js", ".swf");
this.css('width', opt.width);
this.css('height', opt.height);
if (useFlash == true) {
var flashvars = {
width: opt.width,
height: opt.height,
zoom: "1"
};
var params = {};
var attributes = {};
swfobject.embedSWF(flash_dir, this.attr('id'), opt.width, opt.height, "9.0.0", "expressInstall.swf", flashvars, params, attributes);
var camSelector = $(this).get(0);
} else {
var camSelector = this.get(0);
navigator.getMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
navigator.getMedia({
video: true,
audio: false
}, function(e) {
if (navigator.mozGetUserMedia) {
camSelector.mozSrcObject = e
} else if (navigator.webkitGetUserMedia) {
camSelector.src = window.webkitURL.createObjectURL(e)
} else if (navigator.msGetUserMedia) {
camSelector.src = window.URL.createObjectURL(e)
} else {
try {
camSelector.src = window.URL.createObjectURL(e)
} catch (t) {
camSelector.src = e
}
}
camSelector.play()
}, function(e) {})
}
this.Capture = function() {
if (useFlash == true) {
//this my problem
camSelector.actionSelfie("getCapture");
} else {
this.append('<canvas id="jcanvas" style="visibility: hidden;"></canvas>');
canvas = $("#jcanvas").get(0);
canvas.width = opt.width;
canvas.height = opt.height;
canvas.getContext("2d").drawImage(camSelector, 0, 0, opt.width, opt.height);
var img = canvas.toDataURL("image/png");
$("#jcanvas").remove();
return img;
}
}
return this;
}
})(jQuery)
Thanks
1
Replies(1)
jakecigar
Re: Problem Call ExternalInterface flash function
9 years ago
After
//this my problem
add
console.log(camSelector, camSelector.actionSelfie
)
to verify it is properly set and has
actionSelfie
If you have your page on the 'net, I can take a look at it.
JΛ̊KE
Leave a comment on jakecigar's reply
Change topic type
Topic Type :
Discussions
Questions
Ideas
Problems
No of days :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Change topic type
Cancel
Link this topic
Provide the permalink of a topic that is related to this topic
Permalink
Save
Close
Reply to Jasman Ihsana's question
Top
Reply
{"z36713984":[14737000005231278],"z2950240":[14737000005234579]}
Statistics
1
Replies
2367
Views
1
Followers
Tags
Cancel
plugin
externalinterface
webcam
flash
Actions
Permalink