Closed kracekumar closed 11 years ago
timing is driven by slides. to split a video while showing the same slide, you have to duplicate that slide with a different timing
If a video is currently running I would like to get the current time e.g 1.30. So I tried
presentz = new Presentz(".video169", $('.video169').width() + "x" + $('.video169').height(), ".video43", $('.video43').width() + "x" + $(".video43").height());
presentz.Youtube(presentz, ".video169", $('.video169').width(), $('.video169').height())
//also tried
presentz.Youtube(this, ".video169", $('.video169').width(), $('.video169').height())
TypeError: Object #<Object> has no method 'newElementName'
My main motive is to get current time of playing youttube video. Couldn't find any comments in the source code.
presentz.availableVideoPlugins
is undefined.
Sorry, source code is lacking proper documentation. To get the current time, you need to call
presentz.presentation.chapters[presentz.currentChapterIndex].video._plugin.currentTime()
I should add a getCurrentTime()
method to the presentz obj.
Seems currentTime is trying to access undefined ?
Uncaught TypeError: Cannot read property 'getCurrentTime' of undefined presentz-1.2.0.min.js:19
t.currentTime presentz-1.2.0.min.js:19
initPresentz
(anonymous function)
l jquery.min.js:2
c.fireWith jquery.min.js:2
v.extend.ready jquery.min.js:2
A
@player
object is created only when I call changeVideo
in https://github.com/ffissore/presentz.js/blob/master/src/Youtube.coffee#L29.
Then tried
var t = presentz.presentation.chapters[0].video._plugin;
t.changeVideo({url: presentz.presentation.chapters[0].video.url});
console.log(presentz.presentation.chapters[0].video._plugin.currentTime()); // or
console.log(t.presentation.chapters[0].video._plugin.currentTime());
Uncaught TypeError: Cannot read property 'getCurrentTime' of undefined
I've just pushed 1.2.1 with a null check on @player
. You should call that function once the player is set up: that depends on the player and its backend (youtube may sometimes be slow)
BTW: I sugget you to avoid using the minified version while developing, as it reports useless code lines
function youtube() {
var t = presentz.presentation.chapters[0].video._plugin;
t.changeVideo({url: presentz.presentation.chapters[0].video.url});
/*for (var item in t){
console.log(item);
}*/
console.log(t.player);
console.log(t.currentTime());
}
presentz.presentation.chapters[0].video._plugin.ensureYoutubeIframeAPILoaded(youtube);
Error:
Uncaught ReferenceError: YT is not defined presentz-1.2.1.js:326
you are manually calling functions that presentz calls on its own, when it knows it can call them: you should know what you're doing
btw, I've just recall presentz emit a "timechange" event
presentz.on("timechange", function(currentTime) { ... });
Thanks, that makes clear.
All the examples in directory are for auto changing slides w.r.t video, can you show an example how to use get current youtube video timing and current slide no.