Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video Pre-roll #51

Closed
xxxnewbiexxx opened this issue Nov 30, 2021 · 20 comments
Closed

Video Pre-roll #51

xxxnewbiexxx opened this issue Nov 30, 2021 · 20 comments
Labels
question Further information is requested

Comments

@xxxnewbiexxx
Copy link

Hi all, any idea how to implement the video pre-roll ad tag code below inside emulator.js file?

Ad Tag Code:

<script type="text/javascript">
(function(i,w,d,p,c,e,o,a,s,t){

p.poolid = 74997; 
c.background = null;  
c.close = null;    
c.type = 'game';  

t=d.getElementsByTagName('script');if(!w[i]){w[i]={ads:[]};s=d.createElement('script');s.src=(d.location.protocol=='https:'?'//server':'//cdn')+'.cpmstar.com/cached/js/global_v100.pack.js?poolid='+p.poolid;s.type='text/javascript';s.async='';t[0].parentNode.insertBefore(s,t[0]);}w[i].ads.push(a={params:p,config:c,events:e,overlay:o,placeholder:t[t.length-1]});})('cpmstar',window,document,{},{},{},{});
</script>

Thanks in advance for your usual support!

@ethanaobrien
Copy link
Member

Hello, on line 14653 is the code for the adUrl embedding. You might be able to put it in there.
search for the code if (typeof _0xc6823.adUrl === 'string') {

To make it to where the user can only click it after the video ends, you can probably edit the setTimeout feature or edit the setTimeout to show the x button. search for adUrl

@xxxnewbiexxx
Copy link
Author

Hi @ethanaobrien , thanks for your reply. I will make a few tests and let you know ;-)

@xxxnewbiexxx
Copy link
Author

xxxnewbiexxx commented Dec 8, 2021

Hello, on line 14653 is the code for the adUrl embedding. You might be able to put it in there. search for the code if (typeof _0xc6823.adUrl === 'string') {

To make it to where the user can only click it after the video ends, you can probably edit the setTimeout feature or edit the setTimeout to show the x button. search for adUrl

Hi @ethanaobrien , I tried to implement the Ad URL straight into the emulator.js like below:

Line 14653:

if (typeof _0xc6823.adUrl === 'https://mysite.com/ad.html') {

and

Line 14656:

'src': https://mysite.com/ad.html,

But it didn't work :-(

It only works if I add this line:

EJS_AdUrl = 'https://mysite.com/ad.html'

Like the code below:

<script type="text/javascript">
    EJS_player = '#game';
    EJS_gameUrl = 'files/snes/Donkey-Kong-Country.zip'; // Url to Game rom
    EJS_core = 'snes';
    EJS_mouse = false; // SNES Mouse
    EJS_multitap = false; // SNES Multitap
    EJS_pathtodata = 'data/'; //path to all of the wasm and js files. MUST all be in the same directory!!
    //EJS_AdUrl = 'https://mysite.com/ad.html' //path to AD page
</script>
<script src="data/loader.js"></script>

Is it possible to add the Ad URL straight into the emulator.js file?

Thank you!

@ethanaobrien
Copy link
Member

if (typeof _0xc6823.adUrl === 'https://mysite.com/ad.html') { is not proper javascript (unless you have a type named https://mysite.com/ad.html) it must be kept as if (typeof _0xc6823.adUrl === 'string') {

To specify it in the emulator.js file, search for the code //_0x2ba0e6.adUrl = 'https://www.youtube.com/embed/8vkh9UO3PnA', remove the // from the beginning and change the youtube link to the link of your ad page

@xxxnewbiexxx
Copy link
Author

xxxnewbiexxx commented Dec 9, 2021

Thanks for your quick reply @ethanaobrien !

It's not working for me as you can see in the test page below :-(

Test page - https://coolstuffblast.com/games/test.html

Emulator.js file was modified as per your instructions above.

@ethanaobrien
Copy link
Member

Screenshot 2021-12-08 8 51 16 PM
Seems to work fine, just takes a sec to load (as ads always do)

@xxxnewbiexxx
Copy link
Author

Hi @ethanaobrien , that's really strange ... I have cleared my Google Chrome cache, Cloudflare cache, I even tried anonymous browser and it was not working lol ... I had to flush my DNS via CMD to see it was working :-)

Thank you for your help!

The banner ads was an easy implementation via emulator.js , just trying to figure it out how to implement the video pre-roll now.

Is there any easy way to call an ad url from emulator.js to load before the emulator loads using the whole game frame 640x480 pixels?

Thanks in advance for all your help and support!

@ethanaobrien
Copy link
Member

No, this isn't possible in javascript to check if the ad is loaded. Sorry

@xxxnewbiexxx
Copy link
Author

xxxnewbiexxx commented Dec 9, 2021

Hi @ethanaobrien , thanks for your reply.

It doesn´t need to check if the ad is loaded, just need to call and load the ad url in the whole game iframe as soon as it loads the emulator. The video pre-roll script will have the close button and the time set up to work it by itself.

The result would be similar to this one - https://neptunjs.xyz/snes.html

But it would load the video pre-roll ad before ;-)

@ethanaobrien ethanaobrien added the enhancement New feature or request label Jan 6, 2022
@ethanaobrien
Copy link
Member

Sorry for the late reply, got busy then I just kept forgetting to respond.

It doesn´t need to check if the ad is loaded, just need to call and load the ad url in the whole game iframe as soon as it loads the emulator. The video pre-roll script will have the close button and the time set up to work it by itself.

This is what it does, the moment the emulator loads the iframe is created and starts loading

@xxxnewbiexxx
Copy link
Author

xxxnewbiexxx commented Jan 15, 2022

Hi @ethanaobrien , thanks for your reply.

In the new emulator, I couldn't find the code: //_0x2ba0e6.adUrl = 'https://www.youtube.com/embed/8vkh9UO3PnA' in the emulator.js file.

How to implement the Ad URL inside the new emulator.js file?

Thanks in advance for all your help and support!

@ethanaobrien
Copy link
Member

Bottom of the emu-main.js file. Search for this.adUrl =

@ethanaobrien
Copy link
Member

@xxxnewbiexxx Did you ever get this working? Can I close this or?

@xxxnewbiexxx
Copy link
Author

Hi @ethanaobrien, just the banner is working at the moment, still working on the video pre-roll implementation ...

@ethanaobrien ethanaobrien added question Further information is requested and removed enhancement New feature or request labels Feb 7, 2022
@ethanaobrien
Copy link
Member

Im going to assume you've got this under control

I'm closing since this isn't technically an issue, but a question

@xxxnewbiexxx
Copy link
Author

xxxnewbiexxx commented May 31, 2022

Hi @ethanaobrien , have you done any change to the code that skip modifications on emu-main.js ?

I tried to implement the ad URL inside emu-main. js file changing this line:

this.adUrl = null;

to this:

this.adUrl = 'https://mysite.com/adurl.html';

but it's not working :-(

Thanks in advance for all your help and support!

@ethanaobrien
Copy link
Member

ethanaobrien commented May 31, 2022 via email

@xxxnewbiexxx
Copy link
Author

xxxnewbiexxx commented May 31, 2022

Thanks for your reply @ethanaobrien ! How can I define it in the loader.js file?

I tried this:

'undefined' != typeof EJS_AdUrl && (config.adUrl = 'https://mysite.com/adurl.html');

but it didn't work ...

@ethanaobrien
Copy link
Member

ethanaobrien commented Jun 3, 2022 via email

@xxxnewbiexxx
Copy link
Author

Set the config ad url to your site instead of the window variable

How to set this @ethanaobrien ? Could you please help ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants