'How to resolve exoplayer error : AAPT: error: attribute fastforward_increment not found?
Firstly I added the exoplayer dependency to my build. After that I made a xml layout with a custom controller and then I wanted to add app:fastforward_increment & app:rewind_increment. But every time I try to build it throws this error message :
AAPT: error: attribute fastforward_increment not found.
I tried to resolve this issue by adding the other dependecies as they were suggesting in one of the forums but it didn't work. Do you know what's causing the issue and how to solve it?
Solution 1:[1]
The functions app:fastforward_increment & app:rewind_increment were removed in the version 2.15.0 and replaced by setSeekBackIncrementMs and setSeekForwardIncrementMs in SimpleExoPlayer.Builder. So instead of changing this value in xml file, now you have to change it programatically:
SimpleExoPlayer.Builder builder = new SimpleExoPlayer.Builder(context);
builder.setSeekBackIncrementMs(10000);
builder.setSeekForwardIncrementMs(10000);
SimpleExoPlayer simpleExoPlayer = builder.build();
Solution 2:[2]
According to @Kristian answer, app:fastforward_increment and app:rewind_increment were removed. You can set like this:
val player = ExoPlayer.Builder(this)
.setSeekBackIncrementMs(10000)
.setSeekForwardIncrementMs(10000)
.build()
Solution 3:[3]
In the new version com.google.android.exoplayer:exoplayer:2.17.1
of Exoplayer, I deleted the parts in XML and added in the code part.
Xml:
<com.google.android.exoplayer2.ui.StyledPlayerView
android:id="@+id/playerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
argType:resize_mode="fixed_width"
argType:show_buffering="when_playing"
argType:show_fastforward_button="true"
argType:show_next_button="false"
argType:show_previous_button="false"
argType:show_rewind_button="true"
argType:show_subtitle_button="true"
argType:use_artwork="true"
argType:use_controller="true">
</com.google.android.exoplayer2.ui.StyledPlayerView>
Code:
playerView = ExoPlayer.Builder(this)
.setSeekForwardIncrementMs(10000)
.setSeekBackIncrementMs(10000)
.build()
It worked flawlessly.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Kaaveh Mohamedi |
Solution 3 | Halil Ozel |