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

Provide a way to use directly from JS #61

Open
clemos opened this issue Oct 1, 2014 · 13 comments
Open

Provide a way to use directly from JS #61

clemos opened this issue Oct 1, 2014 · 13 comments

Comments

@clemos
Copy link
Contributor

clemos commented Oct 1, 2014

I guess the title says it all :)
We have a JS video player, and would like to implement openVV on it.
Reviewing the code, it seems definitely possible to provide an additionnal "backend" that would wrap the JS code from https://github.com/openvv/openvv/blob/master/src/org/openvv/js/OVVAsset.js into a useable js lib.
Further structuring the js sources would also allow more events to be implemented (onViewable/notViewable, onFocus/onUnfocus), which would be very valuable.

@alonashkenazi
Copy link
Contributor

Add support for JS players (HTML5) is on the roadmap. We can have a chat on the specifications

@clemos
Copy link
Contributor Author

clemos commented Oct 8, 2014

Ok, how do you want to proceed ?

@alonashkenazi
Copy link
Contributor

Sent you an email

@clemos
Copy link
Contributor Author

clemos commented Oct 9, 2014

Here are the features I'd like to see :

  • expose that same API as OVVAsset in JS by
    • porting needed parts of OVVAsset.as to JS
    • including OVVAsset.js directly
    • using both measuring techniques (ie feature detect Flash to use beacons technique)
  • both versions of OVVAsset should expose events on viewability change
    • the common JS part should listen to DOM scroll, window focus/blur, fullscreen and viewability events
    • when beacon method is used, the throttle event is used as well, and relayed to JS
    • eventually, allow the JS version to work across (cross-domain) iframes, as a lot of JS players are bound to iframes

I guess the current OVVAsset.js could include both the code injected by the SWF as well as the native JS API.
I'm not familiar with the whole codebase, but I believe that ideally, we should think about it the other way around: the "main" part should be as much as possible in JS, the only AS3 parts should be the beacon, and an AS3 wrapper to the injected JS API.
Please notice that I never used the VPAID features.

@Brayyy
Copy link

Brayyy commented Dec 11, 2015

Agreed, a JavaScript VPAID (non Flash) wrapper would be helpful.

@goosemanjack
Copy link
Contributor

Instead of using the flash beacon for a pure JS implementation you should consider a postMessage implementation that consists of a host-side geometry component and a cross domain communication pipe.

@EvgenySergeychik
Copy link

@clemos Did you get the standalone OVVAsset.js with the requirements you listed or the current version should have it?
Thanks

@clemos
Copy link
Contributor Author

clemos commented Mar 9, 2017

@EvgenySergeychik nope, I haven't been working on OVV for a while now, and unfortunately never made this standalone JS version :|

@EvgenySergeychik
Copy link

@clemos Thanks for quick reply. So i need to use OVVAsset.js as a wrapper to interop with openvv.swc which has to be imported to project?

@jdreetz
Copy link

jdreetz commented Mar 9, 2017

@EvgenySergeychik If you want to use OVVAsset.js on it's own you need a Javascript class that performs the same functions as OVVAsset.as - https://github.com/InteractiveAdvertisingBureau/openvv/blob/master/src/org/openvv/OVVAsset.as

Your OVVAsset.as replacement will have to create an instance of OVVAsset in JS. You'll need to modify OVVAsset.js in a few ways. One will be to modify what it uses as the player element. You'll have to change that to a specific DOM element you want to measure. The current version of OVV looks for a specific Flash embed on the page to find it - https://github.com/InteractiveAdvertisingBureau/openvv/blob/master/src/org/openvv/js/OVVAsset.js#L1638

Also, you'll need to update the beaconsStarted method that the Flash beacons call to, to tell the player they've started -
https://github.com/InteractiveAdvertisingBureau/openvv/blob/master/src/org/openvv/js/OVVAsset.js#L1055

You'll have to proxy the 'player' with something that can accept the 'onJsReady' calls, that calls back to OVVAsset.as - https://github.com/InteractiveAdvertisingBureau/openvv/blob/master/src/org/openvv/OVVAsset.as#L266

Not sure how urgent your need is, but it might be worth waiting for the HTML5 version of OpenVV to be released. We're still in the architecture phase, but I think the expectation is that it will be released sometime this year. It will make use of IntersectionObserver primarily for measurement. You can see how this works in the current OpenVV here -

https://github.com/InteractiveAdvertisingBureau/openvv/blob/master/src/org/openvv/js/OVVAsset.js#L1316

@EvgenySergeychik
Copy link

@jdreetz Thanks a lot for explanation and guidance.
I will think about it and talk to our team about the strategy, but it is great to know that HTML5 version should be released this year.
One more question: I could implement my own viewability measurement by implementing VPaid wrapper?

@jdreetz
Copy link

jdreetz commented Mar 12, 2017

@EvgenySergeychik - yes, you could probably do that, but the Javascript side doesn't have any VPAID specific listeners. That's all handled on the Flash side - https://github.com/InteractiveAdvertisingBureau/openvv/blob/master/src/org/openvv/OVVAsset.as#L604

@EvgenySergeychik
Copy link

@jdreetz Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants