Here is the whole object called "params" shown in Chrome browser console:
{videoSlot: video#videoSlot, slot: div#adSlot}
slot: div#adSlot
accessKey: ""
align: ""
draggable: false
...
videoSlot: video#videoSlot
accessKey: ""
loop: false
muted: false
...
when I do console.log(params) the above is what I see. But if I do console.log(params.videoSlot), it shows
<video id="videoSlot" style="position:absolute; width:100%; height:100; ...></video>
which is the DOM element of the video. I want to fetch object's metadata not the DOM element. How can I accomplish this? And why does this happen?
So here is more information
I am writing a code that determines what type of media player a particular ads is playing at. The player information is passed as "params" here.
console.log(videoParams.muted) accesses muted metadata and prints "false".
However, console.log(Object.keys(videoParams)) prints out "[]", empty list
Console.dir(videoParams) seems to print out the metadata I desire, however, I don't know how to capture that metadata information and iterate using Object.keys(videoParams).
export default class MediaPlayerClassifier {
constructor() {
// map of events to arrays of pixels
this.identifier = {
'goog': 'GOOGLE_MEDIA_PLAYER',
'yimg': 'YAHOO_MEDIA_PLAYER',
'zzVpaidVideoPlayer': 'ZZ_MEDIA_PLAYER'
};
this.player = null;
}
determine(params, callback) {
videoParams = params.videoSlot
console.dir(videoParams);
var identifierKeys = Object.keys(this.identifier);
var value;
var that = this;
Object.keys(videoParams).forEach(function(key) {
value = videoParams[key];
console.log(value);
if (key === 'baseURI') {
console.log(value);
}
for (var i=0; i < identifierKeys.length; i++) {
var each = identifierKeys[i];
if (value && typeof value === 'string' && value.indexOf(each) !== -1) {
that.player = that.identifier[each];
return callback();
}
}
});
return;
}
getPlayerType() {
return this.player;
}
}