MetaCDN / videojs-vr_OLD

A video.js plugin that turns a video element into a HTML5 Panoramic 360 video player.
MIT License
24 stars 16 forks source link

Best Approach to getting rotation data from plugin #13

Closed mitch-tofi closed 7 years ago

mitch-tofi commented 7 years ago

Hey,

I'm looking into leveraging this plugin and im looking to extra the rotational data from the plugin (ideally as Quaternion).

I believe we could go direct to webgl and extract the data, but it would be ideal to get this information from a more managed pipeline,

Is there a way of currently doing this in the plugin? or is this something coming soon?

Cheers,

Mitch

kfarr commented 7 years ago

Yes +1! I've been speaking with another developer who is also looking for this data. They are looking for Euler format to match the A-Frame implementation, but as I understand it's not terribly difficult to convert to Euler? If there were a standard mechanism to fetch rotation of viewer (camera) from videojs-vr plugin in Quaternion format perhaps we could have a snippet of example code that converts to Euler.

kfarr commented 7 years ago

Okay I've made progress on (1) defining how the data should be exposed and (2) a POC of exposing this data.

(1) Per input from @gkatsev, the "right" way to expose data from a Video.js plugin is to overwrite the namespace of the plugin with an object that has properties and/or methods. For example, on a plugin init function you could include:

var testing = "testing exposed variable";
player.pluginName = {
  testing: testing
};

Here are examples of this done on 2 other plugins:

(2) I have created a proof of concept on a fork: