Workflow Integration JavaScript API bug

Get answers to your questions about color grading, editing and finishing with DaVinci Resolve.
  • Author
  • Message
Offline

michael2021

  • Posts: 7
  • Joined: Tue Jul 06, 2021 7:10 pm
  • Real Name: Jian Li

Workflow Integration JavaScript API bug

PostSat Jun 11, 2022 9:23 am

Davinci Resolve 18 beta4
JS API on Windows11
Code: Select all
resolve.GetProjectManager().GetCurrentTimeline().GetCurrentTimeline().GetStartTimecode()

show errors
Uncaught Error: GetStartTimecode: Error response (errorStr:Invalid number of arguments) (errorCode:2)
Offline

raarts

  • Posts: 4
  • Joined: Sun Mar 07, 2021 10:30 am
  • Real Name: Ron Arts

Re: Workflow Integration JavaScript API bug

PostMon Jul 04, 2022 8:03 am

JS API on Windows11

Does Resolve 18 have a Javascript API?
Where can I get info on it, I really need it!
BTW I'm on Mac.

Thanks.
Ron
Online
User avatar

Joe Shapiro

  • Posts: 769
  • Joined: Thu Jul 25, 2013 7:23 am
  • Location: Los Angeles CA USA

Re: Workflow Integration JavaScript API bug

PostMon Jul 04, 2022 11:55 pm

Would be great to see some example code that does things like iterate over the clips in a timeline doing... something. ;-)
Director, Editor, Problem Solver. Been cutting indie features for 20 years. FCP editor from version 2 to 7.
Resolve 18.0.1
macOS 12.4
MacBook Pro 16" M1 Max 64gb RAM
Offline

Shrinivas Ramani

Blackmagic Design

  • Posts: 2089
  • Joined: Wed Sep 20, 2017 10:19 am

Re: Workflow Integration JavaScript API bug

PostTue Jul 05, 2022 1:58 am

Joe, Ron

The API is not platform specific.

You don't need to start from scratch either. In the Help menu, under Documentation > Technical you can find individual folders of docs, APIs and examples for scripting, workflow integration and other methods of interacting/integrating with Resolve. The JS API is accessible via the workflow integration structure and follows the same function set as the python and Lua APIs.

Regards
Shrinivas
Offline

michael2021

  • Posts: 7
  • Joined: Tue Jul 06, 2021 7:10 pm
  • Real Name: Jian Li

Re: Workflow Integration JavaScript API bug

PostWed Jul 13, 2022 10:48 am

Davinci Resolve 18 beta5 still has the same problem.
Same API in Lua or Python works perfectly.
I'm developing some Workflow Integration Plugin, I need GetStartTimecode to set subtitle timestamp's offset, so i can use 'Insert Selected Subtitles to Timeline Using Timecode' just like what I had wished!
Offline

Shrinivas Ramani

Blackmagic Design

  • Posts: 2089
  • Joined: Wed Sep 20, 2017 10:19 am

Re: Workflow Integration JavaScript API bug

PostWed Jul 13, 2022 6:05 pm

Hi Jian Li

Can you send us some sample code to show where the JS API behaves differently than the Python or Lua APIs?

Thanks
Shrinivas
Offline

michael2021

  • Posts: 7
  • Joined: Tue Jul 06, 2021 7:10 pm
  • Real Name: Jian Li

Re: Workflow Integration JavaScript API bug

PostMon Jul 18, 2022 8:45 am

In Console Lua code type this
Code: Select all
==resolve:GetProjectManager():GetCurrentProject():GetCurrentTimeline():GetStartTimecode()

In Resolve Sample Workflow Integration Plugin and open Developer Tools
type this
Code: Select all
const WorkflowIntegration = require('./WorkflowIntegration.node');
const pluginId = "com.blackmagicdesign.resolve.sampleplugin";
isInitialized = WorkflowIntegration.Initialize(pluginId);
if (!isInitialized) {
    alert("Error: Failed to initialize!");
}

// Get resolve object
resolve = WorkflowIntegration.GetResolve();
if (!resolve) {
    alert("Error: Failed to get resolve object!");
}

const currentTimeline = resolve.GetProjectManager().GetCurrentProject().GetCurrentTimeline()

console.log(currentTimeline)
console.log(currentTimeline.GetStartTimecode())

And then hit the execute button, Developer Tools Console will show this
Code: Select all
Timeline {uniqueId: "1ba00a07-385a-4ee7-a1ab-d05cc0693e8a"}
VM90:17 Uncaught Error: GetStartTimecode: Error response (errorStr:Invalid number of arguments) (errorCode:2)
    at eval (eval at Execute (app.js:4), <anonymous>:17:29)
    at Execute (app.js:4)
    at HTMLInputElement.onclick (index.html:32)
Offline

michael2021

  • Posts: 7
  • Joined: Tue Jul 06, 2021 7:10 pm
  • Real Name: Jian Li

Re: Workflow Integration JavaScript API bug

PostThu Jul 21, 2022 8:16 am

Problem still exist in DaVinci Resolve Studio 18 :(
Offline

michael2021

  • Posts: 7
  • Joined: Tue Jul 06, 2021 7:10 pm
  • Real Name: Jian Li

Re: Workflow Integration JavaScript API bug

PostTue Jul 26, 2022 10:34 am

The problem has been solved in davinci resolve studio 18.0.1 :)

Return to DaVinci Resolve

Who is online

Users browsing this forum: Bing [Bot], Glassjawx, JAFA87, Jerry J Legend, Joe Shapiro, Malcolm DeSoto, panos_mts, Robert Arnold and 135 guests