@memberjunction/ai-heygen 2.32.2 → 2.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
 
2
- > @memberjunction/ai-heygen@2.32.2 build
2
+ > @memberjunction/ai-heygen@2.34.0 build
3
3
  > tsc
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @memberjunction/ai-heygen
2
2
 
3
+ ## 2.34.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [b48d6b4]
8
+ - Updated dependencies [4c7f532]
9
+ - Updated dependencies [54ac86c]
10
+ - @memberjunction/ai@2.34.0
11
+ - @memberjunction/global@2.34.0
12
+
13
+ ## 2.33.0
14
+
15
+ ### Patch Changes
16
+
17
+ - efafd0e: Readme documentation, courtesy of Claude
18
+ - Updated dependencies [efafd0e]
19
+ - @memberjunction/ai@2.33.0
20
+ - @memberjunction/global@2.33.0
21
+
3
22
  ## 2.32.2
4
23
 
5
24
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/ai-heygen",
3
- "version": "2.32.2",
3
+ "version": "2.34.0",
4
4
  "description": "MemberJunction Wrapper for HeyGen Video Generation",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -15,8 +15,8 @@
15
15
  "typescript": "^5.4.5"
16
16
  },
17
17
  "dependencies": {
18
- "@memberjunction/ai": "2.32.2",
19
- "@memberjunction/global": "2.32.2",
18
+ "@memberjunction/ai": "2.34.0",
19
+ "@memberjunction/global": "2.34.0",
20
20
  "elevenlabs": "^1.51.0"
21
21
  }
22
22
  }
package/readme.md CHANGED
@@ -1,2 +1,162 @@
1
- # @memberjunction/ai-elevenlabs
2
- Simple wrapper class for HeyGen AI Models to use with the MemberJunction framework.
1
+ # @memberjunction/ai-heygen
2
+
3
+ A wrapper for HeyGen's video generation API, enabling AI-based avatar videos within the MemberJunction framework.
4
+
5
+ ## Features
6
+
7
+ - **Avatar Video Generation**: Create videos with AI-powered digital avatars
8
+ - **Avatar Management**: Retrieve and manage available avatar options
9
+ - **Custom Backgrounds**: Set custom background images for videos
10
+ - **Audio Integration**: Add voice-overs to avatar videos
11
+ - **Video Customization**: Control output dimensions, avatar scaling, and positioning
12
+ - **Standardized Interface**: Follows MemberJunction's BaseVideoGenerator abstract class pattern
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ npm install @memberjunction/ai-heygen
18
+ ```
19
+
20
+ ## Requirements
21
+
22
+ - Node.js 16+
23
+ - A HeyGen API key
24
+ - MemberJunction Core libraries
25
+
26
+ ## Usage
27
+
28
+ ### Initialize the HeyGen Client
29
+
30
+ ```typescript
31
+ import { HeyGenVideoGenerator } from '@memberjunction/ai-heygen';
32
+
33
+ // Initialize with your API key
34
+ const heyGen = new HeyGenVideoGenerator('your-heygen-api-key');
35
+ ```
36
+
37
+ ### Get Available Avatars
38
+
39
+ Retrieve a list of available avatars to use in your videos:
40
+
41
+ ```typescript
42
+ const avatars = await heyGen.GetAvatars();
43
+
44
+ // Display available avatars
45
+ avatars.forEach(avatar => {
46
+ console.log(`Avatar: ${avatar.name} (ID: ${avatar.id})`);
47
+ console.log(`Gender: ${avatar.gender}`);
48
+ console.log(`Preview Image: ${avatar.previewImageUrl}`);
49
+ console.log(`Preview Video: ${avatar.previewVideoUrl}`);
50
+ console.log('---');
51
+ });
52
+ ```
53
+
54
+ ### Create an Avatar Video
55
+
56
+ Generate a video with an avatar speaking:
57
+
58
+ ```typescript
59
+ import { AvatarVideoParams } from '@memberjunction/ai';
60
+
61
+ // Configure video parameters
62
+ const videoParams: AvatarVideoParams = {
63
+ avatarId: 'avatar-id-from-getavatars',
64
+ audioAssetId: 'your-audio-asset-id',
65
+ imageAssetId: 'your-background-image-id',
66
+ outputWidth: 1280,
67
+ outputHeight: 720,
68
+ scale: 1.0,
69
+ avatarStyle: 'normal',
70
+ offsetX: 0,
71
+ offsetY: 0
72
+ };
73
+
74
+ // Generate the video
75
+ const result = await heyGen.CreateAvatarVideo(videoParams);
76
+
77
+ if (result.success) {
78
+ console.log('Video generation successful!');
79
+ console.log('Video ID:', result.videoId);
80
+ } else {
81
+ console.error('Error generating video:', result.errorMessage);
82
+ }
83
+ ```
84
+
85
+ ### Check Supported Methods
86
+
87
+ Check which methods are supported by the current implementation:
88
+
89
+ ```typescript
90
+ const supportedMethods = await heyGen.GetSupportedMethods();
91
+ console.log('Supported methods:', supportedMethods);
92
+ ```
93
+
94
+ ## API Reference
95
+
96
+ ### HeyGenVideoGenerator Class
97
+
98
+ A class that extends BaseVideoGenerator to provide HeyGen-specific video generation functionality.
99
+
100
+ #### Constructor
101
+
102
+ ```typescript
103
+ new HeyGenVideoGenerator(apiKey: string)
104
+ ```
105
+
106
+ #### Methods
107
+
108
+ - `CreateAvatarVideo(params: AvatarVideoParams): Promise<VideoResult>` - Generate a video with an avatar
109
+ - `CreateVideoTranslation(params: any): Promise<VideoResult>` - (Not yet implemented)
110
+ - `GetAvatars(): Promise<AvatarInfo[]>` - Get a list of available avatars
111
+ - `GetSupportedMethods(): Promise<string[]>` - Get a list of supported methods
112
+
113
+ ### AvatarVideoParams Interface
114
+
115
+ Parameters for creating an avatar video:
116
+
117
+ - `avatarId`: ID of the avatar to use (from GetAvatars)
118
+ - `audioAssetId`: ID of the audio asset for the avatar to speak
119
+ - `imageAssetId`: ID of the background image
120
+ - `outputWidth`: Width of the output video in pixels
121
+ - `outputHeight`: Height of the output video in pixels
122
+ - `scale`: Scale factor for the avatar (1.0 = 100%)
123
+ - `avatarStyle`: Style of the avatar ('normal' or other available styles)
124
+ - `offsetX`: Horizontal position offset of the avatar
125
+ - `offsetY`: Vertical position offset of the avatar
126
+
127
+ ### VideoResult Object
128
+
129
+ Result of video generation operations:
130
+
131
+ - `success`: Boolean indicating if the operation was successful
132
+ - `videoId`: ID of the generated video (if successful)
133
+ - `errorMessage`: Error message (if unsuccessful)
134
+
135
+ ### AvatarInfo Object
136
+
137
+ Information about an available avatar:
138
+
139
+ - `id`: Unique identifier for the avatar
140
+ - `name`: Display name of the avatar
141
+ - `gender`: Gender of the avatar
142
+ - `previewImageUrl`: URL to a preview image of the avatar
143
+ - `previewVideoUrl`: URL to a preview video of the avatar
144
+
145
+ ## HeyGen API Integration
146
+
147
+ This package integrates with the following HeyGen API endpoints:
148
+
149
+ - `https://api.heygen.com/v2/video/generate` - For video generation
150
+ - `https://api.heygen.com/v2/avatars` - For retrieving available avatars
151
+
152
+ Refer to [HeyGen's API documentation](https://docs.heygen.com/) for more details on the underlying API.
153
+
154
+ ## Dependencies
155
+
156
+ - `@memberjunction/ai`: MemberJunction AI core framework
157
+ - `@memberjunction/global`: MemberJunction global utilities
158
+ - `axios`: HTTP client for API requests
159
+
160
+ ## License
161
+
162
+ ISC