Exoplayer Playback Speed
I'm looking to implement an audio player with variable speed playback (1.0x, 1.25x, 1.5x) like typical audiobook players currently on the market do. I would like to use Google's Exoplayer library as my audioplayer library however they don't appear to support variable speed playback. Any ideas on how to implement this, or any extensions that do support this? Thanks in advance!
android exoplayer
add a comment |
I'm looking to implement an audio player with variable speed playback (1.0x, 1.25x, 1.5x) like typical audiobook players currently on the market do. I would like to use Google's Exoplayer library as my audioplayer library however they don't appear to support variable speed playback. Any ideas on how to implement this, or any extensions that do support this? Thanks in advance!
android exoplayer
UPDATE: Just an updated on this for anyone still searching: Exoplayer has added this functionality baked into their API. Happy coding!
– two1stnamz
Mar 2 '18 at 14:59
add a comment |
I'm looking to implement an audio player with variable speed playback (1.0x, 1.25x, 1.5x) like typical audiobook players currently on the market do. I would like to use Google's Exoplayer library as my audioplayer library however they don't appear to support variable speed playback. Any ideas on how to implement this, or any extensions that do support this? Thanks in advance!
android exoplayer
I'm looking to implement an audio player with variable speed playback (1.0x, 1.25x, 1.5x) like typical audiobook players currently on the market do. I would like to use Google's Exoplayer library as my audioplayer library however they don't appear to support variable speed playback. Any ideas on how to implement this, or any extensions that do support this? Thanks in advance!
android exoplayer
android exoplayer
edited Aug 12 '15 at 16:59
two1stnamz
asked Aug 11 '15 at 16:43
two1stnamztwo1stnamz
113112
113112
UPDATE: Just an updated on this for anyone still searching: Exoplayer has added this functionality baked into their API. Happy coding!
– two1stnamz
Mar 2 '18 at 14:59
add a comment |
UPDATE: Just an updated on this for anyone still searching: Exoplayer has added this functionality baked into their API. Happy coding!
– two1stnamz
Mar 2 '18 at 14:59
UPDATE: Just an updated on this for anyone still searching: Exoplayer has added this functionality baked into their API. Happy coding!
– two1stnamz
Mar 2 '18 at 14:59
UPDATE: Just an updated on this for anyone still searching: Exoplayer has added this functionality baked into their API. Happy coding!
– two1stnamz
Mar 2 '18 at 14:59
add a comment |
4 Answers
4
active
oldest
votes
The function setPlaybackSpeed()
was removed and now you set the playback speed via:
PlaybackParameters param = new PlaybackParameters(speed);
mExoPlayer.setPlaybackParameters(param);
speed
is a float number. Normal speed is 1f
and double the speed would be 2f
.
Is this in real-time or load-time?
– Swapnil
Oct 10 '18 at 9:22
@Swapnil: I don't understand what you mean, can you be more specfici about your question?
– Christian
Oct 10 '18 at 9:27
I mean, can we change the pitch and tempo while the media is playing or we only specify ot when the audio is loaded.
– Swapnil
Oct 10 '18 at 9:59
Rate changes can be made during playback.
– TheHairyOne
Oct 18 '18 at 21:53
add a comment |
All you need is https://github.com/waywardgeek/sonic/blob/master/Sonic.java
If you look at MediaCodecAudioTrackRenderer.java,
you can get the output buffer (decoded by MediaCodec) from ExoPlayer in method processOutputBuffer and process it through Sonic.java accordingly before sending it to AudioTrack.
Following document explains how to use libsonic
https://github.com/waywardgeek/sonic/blob/master/doc/index.md
First, thanks for the response @T.J, appreciate it. So I did some Googling and found this github.com/skonb/MediaCodecSpeedControllableTrackRenderer/blob/… Does this implementation look close to what you're talking about? I tried integrating it with the Exoplayer library and there doesn't appear to be any sound.
– two1stnamz
Aug 13 '15 at 21:39
No problem. Yes, thats exactly what I was talking about. Not sure why there is no sound. I would say log processOutputBuffer to see whats happening with the data.
– T.J
Aug 14 '15 at 19:13
add a comment |
Try This
I have followed all the answer nothing worked, so i have tried the below solution, it works for me
PlaybackParams param = new PlaybackParams();
param.setSpeed(1f);// 1f is 1x, 2f is 2x
exoPlayer.setPlaybackParams(param);
add a comment |
You should take a look this project, which was very useful for me:
https://github.com/AmrMohammed89/exoplayer2.4.0_speedup
Inside SimpleExoPlayer, I implemented the next methods:
private final ExoPlayer player;
private float playbackSpeed;
float SPEED_NORMAL = 1f;
float SPEED_MEDIUM = 1.5f;
float SPEED_HIGH = 2f;
@Override
public float getPlaybackSpeed() {
return playbackSpeed;
}
@Override
public void setPlaybackSpeed(float speed) {
playbackSpeed = speed;
player.setPlaybackSpeed(speed);
}
@Override
public void changePlaybackSpeed() {
if (playbackSpeed == SPEED_MEDIUM) {
player.setPlaybackSpeed(SPEED_HIGH);
playbackSpeed = SPEED_HIGH;
} else if (playbackSpeed == SPEED_HIGH) {
player.setPlaybackSpeed(SPEED_NORMAL);
playbackSpeed = SPEED_NORMAL;
} else {
player.setPlaybackSpeed(SPEED_MEDIUM);
playbackSpeed = SPEED_MEDIUM;
}
}
I set and saved the speed that way due to there was a bug when I tried to get the last saved speed. So follow that mechanism and it will work perfectly.
Cheers
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f31947460%2fexoplayer-playback-speed%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
The function setPlaybackSpeed()
was removed and now you set the playback speed via:
PlaybackParameters param = new PlaybackParameters(speed);
mExoPlayer.setPlaybackParameters(param);
speed
is a float number. Normal speed is 1f
and double the speed would be 2f
.
Is this in real-time or load-time?
– Swapnil
Oct 10 '18 at 9:22
@Swapnil: I don't understand what you mean, can you be more specfici about your question?
– Christian
Oct 10 '18 at 9:27
I mean, can we change the pitch and tempo while the media is playing or we only specify ot when the audio is loaded.
– Swapnil
Oct 10 '18 at 9:59
Rate changes can be made during playback.
– TheHairyOne
Oct 18 '18 at 21:53
add a comment |
The function setPlaybackSpeed()
was removed and now you set the playback speed via:
PlaybackParameters param = new PlaybackParameters(speed);
mExoPlayer.setPlaybackParameters(param);
speed
is a float number. Normal speed is 1f
and double the speed would be 2f
.
Is this in real-time or load-time?
– Swapnil
Oct 10 '18 at 9:22
@Swapnil: I don't understand what you mean, can you be more specfici about your question?
– Christian
Oct 10 '18 at 9:27
I mean, can we change the pitch and tempo while the media is playing or we only specify ot when the audio is loaded.
– Swapnil
Oct 10 '18 at 9:59
Rate changes can be made during playback.
– TheHairyOne
Oct 18 '18 at 21:53
add a comment |
The function setPlaybackSpeed()
was removed and now you set the playback speed via:
PlaybackParameters param = new PlaybackParameters(speed);
mExoPlayer.setPlaybackParameters(param);
speed
is a float number. Normal speed is 1f
and double the speed would be 2f
.
The function setPlaybackSpeed()
was removed and now you set the playback speed via:
PlaybackParameters param = new PlaybackParameters(speed);
mExoPlayer.setPlaybackParameters(param);
speed
is a float number. Normal speed is 1f
and double the speed would be 2f
.
answered May 17 '18 at 21:10
ChristianChristian
10.9k2994156
10.9k2994156
Is this in real-time or load-time?
– Swapnil
Oct 10 '18 at 9:22
@Swapnil: I don't understand what you mean, can you be more specfici about your question?
– Christian
Oct 10 '18 at 9:27
I mean, can we change the pitch and tempo while the media is playing or we only specify ot when the audio is loaded.
– Swapnil
Oct 10 '18 at 9:59
Rate changes can be made during playback.
– TheHairyOne
Oct 18 '18 at 21:53
add a comment |
Is this in real-time or load-time?
– Swapnil
Oct 10 '18 at 9:22
@Swapnil: I don't understand what you mean, can you be more specfici about your question?
– Christian
Oct 10 '18 at 9:27
I mean, can we change the pitch and tempo while the media is playing or we only specify ot when the audio is loaded.
– Swapnil
Oct 10 '18 at 9:59
Rate changes can be made during playback.
– TheHairyOne
Oct 18 '18 at 21:53
Is this in real-time or load-time?
– Swapnil
Oct 10 '18 at 9:22
Is this in real-time or load-time?
– Swapnil
Oct 10 '18 at 9:22
@Swapnil: I don't understand what you mean, can you be more specfici about your question?
– Christian
Oct 10 '18 at 9:27
@Swapnil: I don't understand what you mean, can you be more specfici about your question?
– Christian
Oct 10 '18 at 9:27
I mean, can we change the pitch and tempo while the media is playing or we only specify ot when the audio is loaded.
– Swapnil
Oct 10 '18 at 9:59
I mean, can we change the pitch and tempo while the media is playing or we only specify ot when the audio is loaded.
– Swapnil
Oct 10 '18 at 9:59
Rate changes can be made during playback.
– TheHairyOne
Oct 18 '18 at 21:53
Rate changes can be made during playback.
– TheHairyOne
Oct 18 '18 at 21:53
add a comment |
All you need is https://github.com/waywardgeek/sonic/blob/master/Sonic.java
If you look at MediaCodecAudioTrackRenderer.java,
you can get the output buffer (decoded by MediaCodec) from ExoPlayer in method processOutputBuffer and process it through Sonic.java accordingly before sending it to AudioTrack.
Following document explains how to use libsonic
https://github.com/waywardgeek/sonic/blob/master/doc/index.md
First, thanks for the response @T.J, appreciate it. So I did some Googling and found this github.com/skonb/MediaCodecSpeedControllableTrackRenderer/blob/… Does this implementation look close to what you're talking about? I tried integrating it with the Exoplayer library and there doesn't appear to be any sound.
– two1stnamz
Aug 13 '15 at 21:39
No problem. Yes, thats exactly what I was talking about. Not sure why there is no sound. I would say log processOutputBuffer to see whats happening with the data.
– T.J
Aug 14 '15 at 19:13
add a comment |
All you need is https://github.com/waywardgeek/sonic/blob/master/Sonic.java
If you look at MediaCodecAudioTrackRenderer.java,
you can get the output buffer (decoded by MediaCodec) from ExoPlayer in method processOutputBuffer and process it through Sonic.java accordingly before sending it to AudioTrack.
Following document explains how to use libsonic
https://github.com/waywardgeek/sonic/blob/master/doc/index.md
First, thanks for the response @T.J, appreciate it. So I did some Googling and found this github.com/skonb/MediaCodecSpeedControllableTrackRenderer/blob/… Does this implementation look close to what you're talking about? I tried integrating it with the Exoplayer library and there doesn't appear to be any sound.
– two1stnamz
Aug 13 '15 at 21:39
No problem. Yes, thats exactly what I was talking about. Not sure why there is no sound. I would say log processOutputBuffer to see whats happening with the data.
– T.J
Aug 14 '15 at 19:13
add a comment |
All you need is https://github.com/waywardgeek/sonic/blob/master/Sonic.java
If you look at MediaCodecAudioTrackRenderer.java,
you can get the output buffer (decoded by MediaCodec) from ExoPlayer in method processOutputBuffer and process it through Sonic.java accordingly before sending it to AudioTrack.
Following document explains how to use libsonic
https://github.com/waywardgeek/sonic/blob/master/doc/index.md
All you need is https://github.com/waywardgeek/sonic/blob/master/Sonic.java
If you look at MediaCodecAudioTrackRenderer.java,
you can get the output buffer (decoded by MediaCodec) from ExoPlayer in method processOutputBuffer and process it through Sonic.java accordingly before sending it to AudioTrack.
Following document explains how to use libsonic
https://github.com/waywardgeek/sonic/blob/master/doc/index.md
answered Aug 13 '15 at 14:41
T.JT.J
312
312
First, thanks for the response @T.J, appreciate it. So I did some Googling and found this github.com/skonb/MediaCodecSpeedControllableTrackRenderer/blob/… Does this implementation look close to what you're talking about? I tried integrating it with the Exoplayer library and there doesn't appear to be any sound.
– two1stnamz
Aug 13 '15 at 21:39
No problem. Yes, thats exactly what I was talking about. Not sure why there is no sound. I would say log processOutputBuffer to see whats happening with the data.
– T.J
Aug 14 '15 at 19:13
add a comment |
First, thanks for the response @T.J, appreciate it. So I did some Googling and found this github.com/skonb/MediaCodecSpeedControllableTrackRenderer/blob/… Does this implementation look close to what you're talking about? I tried integrating it with the Exoplayer library and there doesn't appear to be any sound.
– two1stnamz
Aug 13 '15 at 21:39
No problem. Yes, thats exactly what I was talking about. Not sure why there is no sound. I would say log processOutputBuffer to see whats happening with the data.
– T.J
Aug 14 '15 at 19:13
First, thanks for the response @T.J, appreciate it. So I did some Googling and found this github.com/skonb/MediaCodecSpeedControllableTrackRenderer/blob/… Does this implementation look close to what you're talking about? I tried integrating it with the Exoplayer library and there doesn't appear to be any sound.
– two1stnamz
Aug 13 '15 at 21:39
First, thanks for the response @T.J, appreciate it. So I did some Googling and found this github.com/skonb/MediaCodecSpeedControllableTrackRenderer/blob/… Does this implementation look close to what you're talking about? I tried integrating it with the Exoplayer library and there doesn't appear to be any sound.
– two1stnamz
Aug 13 '15 at 21:39
No problem. Yes, thats exactly what I was talking about. Not sure why there is no sound. I would say log processOutputBuffer to see whats happening with the data.
– T.J
Aug 14 '15 at 19:13
No problem. Yes, thats exactly what I was talking about. Not sure why there is no sound. I would say log processOutputBuffer to see whats happening with the data.
– T.J
Aug 14 '15 at 19:13
add a comment |
Try This
I have followed all the answer nothing worked, so i have tried the below solution, it works for me
PlaybackParams param = new PlaybackParams();
param.setSpeed(1f);// 1f is 1x, 2f is 2x
exoPlayer.setPlaybackParams(param);
add a comment |
Try This
I have followed all the answer nothing worked, so i have tried the below solution, it works for me
PlaybackParams param = new PlaybackParams();
param.setSpeed(1f);// 1f is 1x, 2f is 2x
exoPlayer.setPlaybackParams(param);
add a comment |
Try This
I have followed all the answer nothing worked, so i have tried the below solution, it works for me
PlaybackParams param = new PlaybackParams();
param.setSpeed(1f);// 1f is 1x, 2f is 2x
exoPlayer.setPlaybackParams(param);
Try This
I have followed all the answer nothing worked, so i have tried the below solution, it works for me
PlaybackParams param = new PlaybackParams();
param.setSpeed(1f);// 1f is 1x, 2f is 2x
exoPlayer.setPlaybackParams(param);
answered Nov 20 '18 at 5:46
SunilSunil
1,71211429
1,71211429
add a comment |
add a comment |
You should take a look this project, which was very useful for me:
https://github.com/AmrMohammed89/exoplayer2.4.0_speedup
Inside SimpleExoPlayer, I implemented the next methods:
private final ExoPlayer player;
private float playbackSpeed;
float SPEED_NORMAL = 1f;
float SPEED_MEDIUM = 1.5f;
float SPEED_HIGH = 2f;
@Override
public float getPlaybackSpeed() {
return playbackSpeed;
}
@Override
public void setPlaybackSpeed(float speed) {
playbackSpeed = speed;
player.setPlaybackSpeed(speed);
}
@Override
public void changePlaybackSpeed() {
if (playbackSpeed == SPEED_MEDIUM) {
player.setPlaybackSpeed(SPEED_HIGH);
playbackSpeed = SPEED_HIGH;
} else if (playbackSpeed == SPEED_HIGH) {
player.setPlaybackSpeed(SPEED_NORMAL);
playbackSpeed = SPEED_NORMAL;
} else {
player.setPlaybackSpeed(SPEED_MEDIUM);
playbackSpeed = SPEED_MEDIUM;
}
}
I set and saved the speed that way due to there was a bug when I tried to get the last saved speed. So follow that mechanism and it will work perfectly.
Cheers
add a comment |
You should take a look this project, which was very useful for me:
https://github.com/AmrMohammed89/exoplayer2.4.0_speedup
Inside SimpleExoPlayer, I implemented the next methods:
private final ExoPlayer player;
private float playbackSpeed;
float SPEED_NORMAL = 1f;
float SPEED_MEDIUM = 1.5f;
float SPEED_HIGH = 2f;
@Override
public float getPlaybackSpeed() {
return playbackSpeed;
}
@Override
public void setPlaybackSpeed(float speed) {
playbackSpeed = speed;
player.setPlaybackSpeed(speed);
}
@Override
public void changePlaybackSpeed() {
if (playbackSpeed == SPEED_MEDIUM) {
player.setPlaybackSpeed(SPEED_HIGH);
playbackSpeed = SPEED_HIGH;
} else if (playbackSpeed == SPEED_HIGH) {
player.setPlaybackSpeed(SPEED_NORMAL);
playbackSpeed = SPEED_NORMAL;
} else {
player.setPlaybackSpeed(SPEED_MEDIUM);
playbackSpeed = SPEED_MEDIUM;
}
}
I set and saved the speed that way due to there was a bug when I tried to get the last saved speed. So follow that mechanism and it will work perfectly.
Cheers
add a comment |
You should take a look this project, which was very useful for me:
https://github.com/AmrMohammed89/exoplayer2.4.0_speedup
Inside SimpleExoPlayer, I implemented the next methods:
private final ExoPlayer player;
private float playbackSpeed;
float SPEED_NORMAL = 1f;
float SPEED_MEDIUM = 1.5f;
float SPEED_HIGH = 2f;
@Override
public float getPlaybackSpeed() {
return playbackSpeed;
}
@Override
public void setPlaybackSpeed(float speed) {
playbackSpeed = speed;
player.setPlaybackSpeed(speed);
}
@Override
public void changePlaybackSpeed() {
if (playbackSpeed == SPEED_MEDIUM) {
player.setPlaybackSpeed(SPEED_HIGH);
playbackSpeed = SPEED_HIGH;
} else if (playbackSpeed == SPEED_HIGH) {
player.setPlaybackSpeed(SPEED_NORMAL);
playbackSpeed = SPEED_NORMAL;
} else {
player.setPlaybackSpeed(SPEED_MEDIUM);
playbackSpeed = SPEED_MEDIUM;
}
}
I set and saved the speed that way due to there was a bug when I tried to get the last saved speed. So follow that mechanism and it will work perfectly.
Cheers
You should take a look this project, which was very useful for me:
https://github.com/AmrMohammed89/exoplayer2.4.0_speedup
Inside SimpleExoPlayer, I implemented the next methods:
private final ExoPlayer player;
private float playbackSpeed;
float SPEED_NORMAL = 1f;
float SPEED_MEDIUM = 1.5f;
float SPEED_HIGH = 2f;
@Override
public float getPlaybackSpeed() {
return playbackSpeed;
}
@Override
public void setPlaybackSpeed(float speed) {
playbackSpeed = speed;
player.setPlaybackSpeed(speed);
}
@Override
public void changePlaybackSpeed() {
if (playbackSpeed == SPEED_MEDIUM) {
player.setPlaybackSpeed(SPEED_HIGH);
playbackSpeed = SPEED_HIGH;
} else if (playbackSpeed == SPEED_HIGH) {
player.setPlaybackSpeed(SPEED_NORMAL);
playbackSpeed = SPEED_NORMAL;
} else {
player.setPlaybackSpeed(SPEED_MEDIUM);
playbackSpeed = SPEED_MEDIUM;
}
}
I set and saved the speed that way due to there was a bug when I tried to get the last saved speed. So follow that mechanism and it will work perfectly.
Cheers
answered Sep 1 '17 at 15:47
Fernando PrietoFernando Prieto
418315
418315
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f31947460%2fexoplayer-playback-speed%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
UPDATE: Just an updated on this for anyone still searching: Exoplayer has added this functionality baked into their API. Happy coding!
– two1stnamz
Mar 2 '18 at 14:59