RSATom / WebChimera.js

[ABANDONED] libvlc binding for Electron
GNU Lesser General Public License v2.1
661 stars 105 forks source link

Question: Example of using `time` method #89

Closed amilajack closed 8 years ago

amilajack commented 8 years ago

How can I use the time method to seek a video?

Here's what I essentially have:

const vlc = require('wcjs-prebuilt').createPlayer(); // eslint-disable-line
renderer.bind(element, vlc);
vlc.play(streamingUrl);

vlc.time(30000) // some time in miliseconds
thers commented 8 years ago

This is not a method, its a property.

vlc.time = 1000; // will seek to 1 second from start

VlcPlayer docs

amilajack commented 8 years ago

Is it possible to change the seek time?

RSATom commented 8 years ago

Is it possible to change the seek time?

Don't understand what you mean.

amilajack commented 8 years ago

Is it possible to change the current time of the vlc player? If so, it would be nice if you could show me an example.

jaruba commented 8 years ago

@amilajack

console.log(vlc.time); // current time of playback in milliseconds
vlc.time = 1000; // set time in milliseconds, current example seeks to 00:01:00

console.log(vlc.position); // current position in playback as float (0.0 to 1.0)
vlc.position = 0.5; // set position as float, current example will seek to 50% of the total duration
amilajack commented 8 years ago

@jaruba I am not sure what you mean by 'current position in playback'

jaruba commented 8 years ago

video has 03:02:43 length, you watched 01:00:00 of it, then vlc.position will return something like 0.33 (because you watched 33% of the video)

amilajack commented 8 years ago

Ohhh got it! Thanks.

amilajack commented 8 years ago

Works properly now. Thanks!