Quick use isn't showing anything
Fire-Brand opened this issue · comments
Hi, i'm trying to use this awesome looking lib with no avail...
I've add the VPAIDFLASHClient.js
file from VPAIDFLASHClient-master\bin\
to my index.html
's header (along with swfobject.js
) and i'm trying to run the flash client on my div
with the VPAIDFlash.swf
file.
Trying to work with the "Usage" example (or even the demo example), the object loads and my html5 player disappears and instead i see nothing, inspecting the element shows that the <object>
is indeed there with everything set correctly it's just that the function flashVPAIDWrapperLoaded(err, result)
does nothing and jumps to the error section saying it timedout (10 secoends i believe).
Any idea what my be the cause? here is how i call the function:
var flashVPaid = new VPAIDFLASHClient($(elem)[0], flashVPAIDWrapperLoaded); // $(elem)[0] is an object
function flashVPAIDWrapperLoaded(err, result) {
if (err) { //this is where we get after 10 seconds that nothing happens
return;
}
flashVPaid.loadAdUnit('VPAIDFlash.swf', function (error, adUnit) { // VPAIDFlash.swf sits in the same dir
if (err) {
//handle error here
return;
}
adUnit.on('AdLoaded', function (err, result) {
console.log('event:AdLoaded', err, result);
startAd();
});
adUnit.on('AdStarted', function (err, result) {
console.log('event:AdStarted', err, result);
checkAdProperties();
});
adUnit.handshakeVersion('2.0', function (err, result) {
initAd();
});
function initAd() {
adUnit.initAd(600, 480, 'normal', -1, '', '', function (err) {
console.log('initAd', err);
});
}
function startAd() {
adUnit.startAd(function (err, result) {
console.log('startAd call', err, result);
});
}
function checkAdProperties() {
adUnit.getAdIcons(function (err, result) {
console.log('getAdIcons', result);
});
adUnit.setAdVolume(10, function (err, result) {
console.log('setAdVolume', result);
});
adUnit.getAdVolume(function (err, result) {
console.log('getAdVolume', result);
});
}
});
}
Btw, the Demo also doesn't seem to work, same issue...
_UPDATE:_
working with the Flash Player debugger in FireFox i get this error:
SecurityError: Error #2060: Security sandbox violation: ExternalInterface caller file:///C:/User/workspace/project/VPAIDFlash.swf cannot access file:///C:/User/workspace/project/index.html.
at flash.external::ExternalInterface$/_initJS()
at flash.external::ExternalInterface$/addCallback()
at com.dailymail.vpaid::VPAIDFlash/addVPAIDInterface()
at com.dailymail.vpaid::VPAIDFlash()
_UPDATE 2:_
it seems that working on a local server worked that out and the entire issue comes down to a different problem, unlike the example in the "usage" section, where var flashVPaid
is set above the flashVPAIDWrapperLoaded
function, my instantiation of VPAIDFLASHClient($(elem)[0], flashVPAIDWrapperLoaded)
happend in a different function and the callback is written outside of that (can't write it inside):
function setVPAIDToLoad(player, adObj, isAutoPlay) {
if (isAdFlash()) {
var flashVPaid = new VPAIDFLASHClient($(elem)[0], flashVPAIDWrapperLoaded);
}
function flashVPAIDWrapperLoaded (err, result) {
if (err) { return; }
flashVPaid.loadAdUnit('VPAIDFlash.swf', function (error, adUnit) { // flashVPaid is undefined
if (err) {return;}
... //rest of function
how should i handle this properly?
_UPDATE 3:_
it seems that all i had to do is work on a server and not with the VPAIDFlash.swf file, when i changed to one of the urls in the demo, it workd! issue can be closed now 😃
@Fire-Brand Yes for security reasons you need to use a localserver to test it. You can try to change the flash settings in this page:
http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html
But normally I use some server to test it.