Ниже приведен мой код;
Можно ли программно создать файл mp3 в файл .srt?
holder.llView.setOnClickListener(new View.OnClickListener() {
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public void onClick(View v) {
MediaPlayer mediaPlayer = new MediaPlayer();
try {
mediaPlayer.setDataSource(filePathList.get(position));
mediaPlayer.prepare();
//mediaPlayer.addTimedTextSource(subTitleSrc, MediaPlayer.MEDIA_MIMETYPE_TEXT_SUBRIP);
//int textTrackIndex = findTrackIndexFor(
//MediaPlayer.TrackInfo.MEDIA_TRACK_TYPE_TIMEDTEXT,
//mediaPlayer.getTrackInfo());
//if (textTrackIndex >= 0) {
// mediaPlayer.selectTrack(textTrackIndex);
//} else {
// Log.w("test", "Cannot find text track!");
//}
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
// mediaPlayer.setOnTimedTextListener(new MediaPlayer.OnTimedTextListener() {
//@Override
//public void onTimedText(final MediaPlayer mediaPlayer, final TimedText timedText) {
//if (timedText != null) {
//Log.d("test", "subtitle: " + timedText.getText());
// }
// }
// });
// }
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
} catch (IOException e) {
e.printStackTrace();
}
mediaPlayer.start();
}
});
Ниже код для команды ffmpeg;
String cmd= "ffmpeg -i"+ filePathList.get(position).substring(filePathList.get(position).lastIndexOf("/")+1);
FFmpeg ffmpeg = FFmpeg.getInstance(CountryListActivity.this);
try {
// to execute "ffmpeg -version" command you just need to pass "-version"
ffmpeg.execute(new String[]{cmd}, new ExecuteBinaryResponseHandler() {
@Override
public void onStart() {
Log.e("!!!!!!!!!",""+filePathList.get(position));
}
@Override
public void onProgress(String message) {
Log.e("message..............",""+message);
}
@Override
public void onFailure(String message) {
Log.e("messageeeeeeeee..............",""+message);
}
@Override
public void onSuccess(String message) {
Log.e("messageeeeeeewwwwwwwwwwwee..............",""+message);
}
@Override
public void onFinish() {
Log.e("messagewwwewreeeeeeee..............","");
}
});
} catch (FFmpegCommandAlreadyRunningException e) {
// Handle if FFmpeg is already running
e.printStackTrace();
}