Giter Site home page Giter Site logo

Comments (2)

emettely avatar emettely commented on June 18, 2024

Are there any known issues around laggy playback? We will need to look at this in more detail, but noticed it when trying out an electron app version of Digital Paper Edit.

from digital-paper-edit-client.

pietrop avatar pietrop commented on June 18, 2024

1. total duration

Get the time at which the last node in the current internal timeline finishes playing.

var canvasElement = document.getElementById("canvas");
var ctx = new VideoContext(canvasElement);
console.log(ctx.duration); //prints 0

var videoNode = ctx.video("video.mp4");
videoNode.connect(ctx.destination);
videoNode.start(0);
videoNode.stop(10);

console.log(ctx.duration); //prints 10

ctx.play();

From the docs .duration

2. get current time

.currentTime

Get how far through the internal timeline has been played.
Getting this value will give the current playhead position. Can be used for updating timelines.

var canvasElement = document.getElementById("canvas");
var ctx = new VideoContext(canvasElement);
var videoNode = ctx.video("video.mp4");
videoNode.connect(ctx.destination);
videoNode.start(0);
videoNode.stop(10);
ctx.play();
setTimeout(() => console.log(ctx.currentTime),1000); //should print roughly 1.0

ca probably use registerCallback to listen for time change? (not sure exactly how)

Register a callback to listen to one of the events defined in VideoContext.EVENTS

3. flatten the progress bar

🤷‍♂ - see @melnyczuk 's PR #41 & #41 (comment)

4 . set current time

How to make the BBC Video context jump to a specific point, eg equivalent of .currentTime =

Similarly to .currentTime in HTML5 media, it can be used both as a get and as a set,

var canvasElement = document.getElementById("canvas");
var ctx = new VideoContext(canvasElement);
var videoNode = ctx.video("video.mp4");
videoNode.connect(ctx.destination);
videoNode.start(0);
videoNode.stop(20);
ctx.currentTime = 10; // seek 10 seconds in
ctx.play();https://github.com/bbc/digital-paper-edit-client/issues/45#

from BBC Video Context .currentTime docs.

5. update playlist

Maybe is a matter of calling/exposing loadPlaylist outside of the component
(/bbc/digital-paper-edit-client/src/Components/PaperEdits/PaperEdit/ProgramScript/PreviewCanvas/VideoContextViewer.js#L35)

However it might be necessary to clear the nodes in the timeline first.

The VideoContext now also has a reset() method, which as well as automatically calling destroy on all nodes will also remove all callbacks registered to the VideoContext.

from bbc/VideoContext#37 (comment)

Destroy all nodes in the graph and reset the timeline. After calling this any created nodes will be unusable.

from docs reset()

Other

Other interesting once found in the docs, that can be useful to improve the preview player functionalities

from digital-paper-edit-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.