Skip to content

🎥 Make videos programmatically with React

add volume

Jonny Burger1bbaeff54787
diff --git a/packages/renderer/src/assets/calculate-asset-positions.ts b/packages/renderer/src/assets/calculate-asset-positions.ts
index 17cf2ffdc9..2b58db9458 100644
--- a/packages/renderer/src/assets/calculate-asset-positions.ts
+++ b/packages/renderer/src/assets/calculate-asset-positions.ts
@@ -32,6 +32,7 @@ export const calculateAssetPositions = (frames: TAsset[][]): Assets => {
duration: null,
startInVideo: frame,
trimLeft: asset.sequenceFrame,
+ volume: asset.volume,
});
}
diff --git a/packages/renderer/src/test/asset-is-used-at-time.test.ts b/packages/renderer/src/test/asset-is-used-at-time.test.ts
index 25d4df1c90..d5a2889df6 100644
--- a/packages/renderer/src/test/asset-is-used-at-time.test.ts
+++ b/packages/renderer/src/test/asset-is-used-at-time.test.ts
@@ -9,6 +9,7 @@ test('Should give true is asset is used at time', () => {
startInVideo: 0,
trimLeft: 2,
type: 'audio',
+ volume: 1,
},
1
)
@@ -21,6 +22,7 @@ test('Should give true is asset is used at time', () => {
startInVideo: 1,
trimLeft: 0,
type: 'audio',
+ volume: 1,
},
1
)
@@ -36,6 +38,7 @@ test('Should give false if asset is not used at time', () => {
startInVideo: 1,
trimLeft: 0,
type: 'audio',
+ volume: 1,
},
0
)
@@ -48,6 +51,7 @@ test('Should give false if asset is not used at time', () => {
startInVideo: 1,
trimLeft: 0,
type: 'audio',
+ volume: 1,
},
3
)
diff --git a/packages/renderer/src/test/ffmpeg-filters.test.ts b/packages/renderer/src/test/ffmpeg-filters.test.ts
index 3151699f07..c0d0f888ae 100644
--- a/packages/renderer/src/test/ffmpeg-filters.test.ts
+++ b/packages/renderer/src/test/ffmpeg-filters.test.ts
@@ -11,6 +11,7 @@ const asset: MediaAsset = {
duration: 20,
startInVideo: 0,
trimLeft: 0,
+ volume: 1,
};
test('Should create a basic filter correctly', () => {
diff --git a/packages/renderer/src/test/map-localhost-to-file.test.ts b/packages/renderer/src/test/map-localhost-to-file.test.ts
index 09700e331c..45ce25e598 100644
--- a/packages/renderer/src/test/map-localhost-to-file.test.ts
+++ b/packages/renderer/src/test/map-localhost-to-file.test.ts
@@ -9,6 +9,7 @@ test('Should correctly map a localhost URL to an asset', async () => {
src: 'http://localhost:3000/5f25ba62771d1f8195f858ec5ff8e8d6.mp4',
id: '0.8331499681195862',
sequenceFrame: 2045,
+ volume: 1,
},
webpackBundle:
'/var/folders/hl/p8pg9kw15dbg3l7dbpn0scc80000gn/T/react-motion-graphicstoSTC7',
diff --git a/packages/renderer/src/test/split-assets-into-segments.test.tsx b/packages/renderer/src/test/split-assets-into-segments.test.tsx
index 0614aac1f3..f82bfc2a92 100644
--- a/packages/renderer/src/test/split-assets-into-segments.test.tsx
+++ b/packages/renderer/src/test/split-assets-into-segments.test.tsx
@@ -10,6 +10,7 @@ test('Should create segments of audio clips correctly', () => {
startInVideo: 0,
trimLeft: 0,
type: 'video',
+ volume: 1,
},
// Clip from 5-15 seconds
{
@@ -18,6 +19,7 @@ test('Should create segments of audio clips correctly', () => {
startInVideo: 150,
trimLeft: 0,
type: 'video',
+ volume: 1,
},
];
expect(splitAssetsIntoSegments({assets, duration: 450})).toEqual([
@@ -27,6 +29,7 @@ test('Should create segments of audio clips correctly', () => {
startInVideo: 0,
trimLeft: 0,
type: 'video',
+ volume: 1,
},
{
duration: 150,
@@ -34,6 +37,7 @@ test('Should create segments of audio clips correctly', () => {
startInVideo: 150,
trimLeft: 150,
type: 'video',
+ volume: 1,
},
{
duration: 150,
@@ -41,6 +45,7 @@ test('Should create segments of audio clips correctly', () => {
startInVideo: 150,
trimLeft: 0,
type: 'video',
+ volume: 1,
},
{
duration: 150,
@@ -48,6 +53,7 @@ test('Should create segments of audio clips correctly', () => {
startInVideo: 300,
trimLeft: 150,
type: 'video',
+ volume: 1,
},
]);
});
@@ -61,6 +67,7 @@ test('Should leave single clip untouched', () => {
startInVideo: 0,
trimLeft: 0,
type: 'video',
+ volume: 1,
},
];
expect(splitAssetsIntoSegments({assets, duration: 450})).toEqual([
@@ -83,6 +90,7 @@ test('Should leave two identical clips the same', () => {
startInVideo: 0,
trimLeft: 0,
type: 'video',
+ volume: 1,
},
{
duration: 300,
@@ -90,6 +98,7 @@ test('Should leave two identical clips the same', () => {
startInVideo: 0,
trimLeft: 0,
type: 'video',
+ volume: 1,
},
];
expect(splitAssetsIntoSegments({assets, duration: 450})).toEqual([
@@ -119,6 +128,7 @@ test('Should not have one-off errors', () => {
startInVideo: 0,
trimLeft: 0,
type: 'video',
+ volume: 1,
},
{
duration: 2,
@@ -126,6 +136,7 @@ test('Should not have one-off errors', () => {
startInVideo: 1,
trimLeft: 0,
type: 'video',
+ volume: 1,
},
{
duration: 2,
@@ -133,6 +144,7 @@ test('Should not have one-off errors', () => {
startInVideo: 2,
trimLeft: 0,
type: 'video',
+ volume: 1,
},
];
expect(splitAssetsIntoSegments({assets, duration: 450})).toEqual([
@@ -142,6 +154,7 @@ test('Should not have one-off errors', () => {
startInVideo: 0,
trimLeft: 0,
type: 'video',
+ volume: 1,
},
{
duration: 1,
@@ -149,6 +162,7 @@ test('Should not have one-off errors', () => {
startInVideo: 1,
trimLeft: 1,
type: 'video',
+ volume: 1,
},
{
duration: 1,
@@ -156,6 +170,7 @@ test('Should not have one-off errors', () => {
startInVideo: 1,
trimLeft: 0,
type: 'video',
+ volume: 1,
},
{
duration: 1,
@@ -163,6 +178,7 @@ test('Should not have one-off errors', () => {
startInVideo: 2,
trimLeft: 1,
type: 'video',
+ volume: 1,
},
{
duration: 1,
@@ -170,6 +186,7 @@ test('Should not have one-off errors', () => {
startInVideo: 2,
trimLeft: 0,
type: 'video',
+ volume: 1,
},
{
duration: 1,
@@ -177,6 +194,7 @@ test('Should not have one-off errors', () => {
startInVideo: 3,
trimLeft: 1,
type: 'video',
+ volume: 1,
},
]);
});