Skip to content

Commit

Permalink
#7 fix ffmpeg path after install
Browse files Browse the repository at this point in the history
  • Loading branch information
moshfeu committed Dec 14, 2018
1 parent 3db96a7 commit 7d81a7a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/install-ffmpeg.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import { installFfmpeg } from '../services/ffmpeg-installer';
import ButtonProgress from './button-progress';
import { ButtonProgress } from './button-progress';
import { setFfmpegPath } from '../services/api';

interface IInstallFFMpegState {
downloadProgress: number;
Expand All @@ -24,6 +25,7 @@ export class InstallFFMpeg extends React.Component<IInstallFFMpegProps, IInstall
downloadProgress: Math.floor(data.progress * 100)
}, () => {
if (this.state.downloadProgress === 100) {
setFfmpegPath();
setTimeout(() => {
this.props.onDone();
}, 2000);
Expand Down
5 changes: 5 additions & 0 deletions src/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as YoutubeMp3Downloader from 'youtube-mp3-downloader';
import * as ytlist from 'youtube-playlist';
import { IVideoEntity, IPlaylistYoutube, EVideoStatus } from '../types';
import { DOWNLOADS_FOLDER, ffmpegPath } from './path';
var ffmpeg = require("fluent-ffmpeg");

export const downloader = new YoutubeMp3Downloader({
ffmpegPath: ffmpegPath(), // Where is the FFmpeg binary located?
Expand All @@ -11,6 +12,10 @@ export const downloader = new YoutubeMp3Downloader({
progressTimeout: 1000 // How long should be the interval of the progress reports
});

export function setFfmpegPath() {
ffmpeg.setFfmpegPath(ffmpegPath());
}

export function fetchVideos(playlistUrl: string): Promise<IVideoEntity[]> {

//Configure YoutubeMp3Downloader with your settings
Expand Down

0 comments on commit 7d81a7a

Please sign in to comment.