npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@d-id/node-sdk

v1.9.0

Published

D-ID Node SDK

Downloads

25

Readme

D-ID Node SDK

npm version License

It's time to supercharge your product with the amazing Generative AI capabilities of D-ID's API. Using our state-of-the-art, battle-tested products, you can now create videos of Digital Humans at an unbelievable scale. Combine your ideas with our tech to create astonishing visuals that are high quality and customized to your needs

D-ID Node SDK specifically designed to help you incorporate the D-ID API into your applications with ease.

Installation

Install via npm:

npm install @d-id/node.js-sdk

Install via yarn:

yarn add @d-id/node.js-sdk

Explore the docs.

Table of contents

Enumerations

Classes

Interfaces

Usage

Import DidClient

const DidClient = require("@d-id/node.js-sdk").default;

or

import DidClient from "@d-id/node.js-sdk";

Talks

Get talks list

const did = new DidClient("DID_API_KEY");

(async () => {
  const talks: GetTalksDto = await did.talks.list();
})();

Get talk by id

const did = new DidClient("DID_API_KEY");

(async () => {
  const talkId = "my-talk-id";
  const talk: GetTalkDto = await did.talks.get("talk_id");
})();

Create talk

const did = new DidClient("DID_API_KEY");

(async () => {
  const talkRequest: CreateTalkRequest = {
    script: {
      type: "text",
      subtitles: "false",
      provider: {
        type: "microsoft",
        voice_id: "en-US-JennyNeural",
      },
      ssml: "false",
    },
    config: {
      fluent: "false",
      pad_audio: "0.0",
    },
  };
  const createTalkResponse: CreateTalkResponseDto = await did.talks.create(
    talkRequest
  );
})();

Create talk async

const did = new DidClient("DID_API_KEY");

(async () => {
  const talkRequest: CreateTalkRequest = {
    script: {
      type: "text",
      subtitles: "false",
      provider: {
        type: "microsoft",
        voice_id: "en-US-JennyNeural",
      },
      ssml: "false",
    },
    config: {
      fluent: "false",
      pad_audio: "0.0",
    },
  };
  const createTalkResponse: Promise<CreateTalkResponseDto> = did.talks
    .createAsync(talkRequest)
    .then((talk) => {
      console.log(talk);
    })
    .catch((err) => console.log(err));
})();

Delete talk

const did = new DidClient("DID_API_KEY");

(async () => {
  const talkId = "my-talk-id";
  const deleteResponse = await did.talks.delete(talkId);
})();

Steams

Init a stream

const did = new DidClient("DID_API_KEY");

(async () => {
  const initStreamRequest: InitStreamDto = {
    source_url: "https://url/to/a/photo/you/wish/to/animate",
  };
  const initStreamResponse: CreateStreamResponseDto =
    await did.talks.initStream(initStreamRequest);
})();

Start a stream

const did = new DidClient("DID_API_KEY");

(async () => {
  const streamId = "my-stream-id";
  const starStreamRequest: CreateStreamRequestDto = {};
  const startStreamResponse: StartConnection200Response =
    await did.talks.startStream(streamId, starStreamRequest);
})();

Submit network information

const did = new DidClient("DID_API_KEY");

(async () => {
  const streamId = "my-stream-id";
  const submitNetworkRequest: CreateStreamIceCandidateRequest = {};
  const submitNetworkResponse: StartConnection200Response =
    await did.talks.submitNetwork(streamId, submitNetworkRequest);
})();

Create a talk stream

const did = new DidClient("DID_API_KEY");

(async () => {
  const streamId = "my-stream-id";
  const createTalkStreamRequest: CreateTalkStreamRequest = {};
  const createTalkStreamResponse: CreateTalkStream200Response =
    await did.talks.createStream(streamId, createTalkStreamRequest);
})();

Delete a talk stream

const did = new DidClient("DID_API_KEY");

(async () => {
  const streamId = "my-stream-id";
  const deleteStreamRequest: DeleteStreamRequest = {
    session_id: "session-id",
  };
  const deleteStreamResponse: StartConnection200Response =
    await did.talks.deleteStream(streamId, deleteStreamRequest);
})();

Clips

Get clips

const did = new DidClient("DID_API_KEY");

(async () => {
  const clipsResponse: GetClipsResponse = await did.clips.list();
})();

Get specific clip

const did = new DidClient("DID_API_KEY");

(async () => {
  const clipId = "my-clip-id";
  const clipResponse: GetClipResponse = await did.clips.get(clipId);
})();

Create a clip

const did = new DidClient("DID_API_KEY");

(async () => {
  const createClipRequest: CreateClipRequest = {
    script: {
      type: "text",
      subtitles: "false",
      provider: {
        type: "microsoft",
        voice_id: "en-US-JennyNeural",
      },
      ssml: "false",
    },
    config: {
      result_format: "mp4",
    },
    presenter_config: {
      crop: {
        type: "rectangle",
      },
    },
  };
  const createResponse: CreateClipResponse = await did.clips.create(
    createClipRequest
  );
})();

Create a clip async

const did = new DidClient("DID_API_KEY");

(async () => {
  const createClipRequest: CreateClipRequest = {
    script: {
      type: "text",
      subtitles: "false",
      provider: {
        type: "microsoft",
        voice_id: "en-US-JennyNeural",
      },
      ssml: "false",
    },
    config: {
      result_format: "mp4",
    },
    presenter_config: {
      crop: {
        type: "rectangle",
      },
    },
  };
  const createResponse: Promise<GetClipResponse> = did.clips
    .create(createClipRequest)
    .then((clip) => {
      console.log(clip);
    })
    .catch((err) => console.log(err));
})();

Delete clip

const did = new DidClient("DID_API_KEY");

(async () => {
  const clipId = "my-clip-id";
  const deleteResponse = await did.clips.delete(clipId);
})();

Get a list of the presenters

const did = new DidClient("DID_API_KEY");

(async () => {
  const presentersResponse: GetClipsPresentersResponse =
    await did.clips.listPresenters();
})();

Get presenter by id

const did = new DidClient("DID_API_KEY");

(async () => {
  const presenterId = "my-presenter-id";
  const getPresenterResponse: GetClipsPresentersResponse =
    await did.clips.getPresenter(presenterId);
})();

Get presenter drivers by id

const did = new DidClient("DID_API_KEY");

(async () => {
  const presenterId = "my-presenter-id";
  const presenterDriversResponse: GetClipsDriversResponse =
    await did.clips.getPresenterDrivers(presenterId);
})();

Contribute

TBD

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.