Skip to content

Commit

Permalink
fix: 解决MTK等CPU硬解码失败
Browse files Browse the repository at this point in the history
ExoPlayer使用系统的默认内核进行解码
  • Loading branch information
SherlockGougou committed Jan 20, 2025
1 parent 186384a commit 66ed18a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ https://github.com/user-attachments/assets/070caa63-8e9f-4b11-9240-4cb56440d3c2
}
```
#### Step 2. 在你app的build.gradle中添加依赖:
当前最新版本为:```androidx-8.1.3```
当前最新版本为:```androidx-8.2.0```
```
dependencies {
// 本框架
implementation 'com.github.SherlockGougou:BigImageViewPager:androidx-8.1.3'
implementation 'com.github.SherlockGougou:BigImageViewPager:androidx-8.2.0'
// glide
implementation 'com.github.bumptech.glide:glide:4.16.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.media3.common.util.UnstableApi
import androidx.media3.exoplayer.DefaultRenderersFactory
import androidx.media3.exoplayer.ExoPlayer
import androidx.media3.exoplayer.mediacodec.MediaCodecSelector
import androidx.media3.exoplayer.source.DefaultMediaSourceFactory
import androidx.viewpager.widget.ViewPager.OnPageChangeListener
import cc.shinichi.library.GlobalContext
Expand Down Expand Up @@ -323,6 +325,8 @@ class ImagePreviewActivity : AppCompatActivity(), Handler.Callback, View.OnClick
fun getExoPlayer(): ExoPlayer {
return ExoPlayer.Builder(context)
.setMediaSourceFactory(DefaultMediaSourceFactory(GlobalContext.getCacheDataSourceFactory()))
.setRenderersFactory(DefaultRenderersFactory(context).setMediaCodecSelector(
MediaCodecSelector.DEFAULT))
.build()
}

Expand Down
3 changes: 0 additions & 3 deletions library/src/main/res/values/style.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
<resources>

<style name="Theme.ImagePreview" parent="Theme.AppCompat.NoActionBar">
<item name="windowNoTitle">true</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowContentOverlay">@null</item>
<item name="background">@null</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowIsTranslucent">true</item>
</style>
Expand Down
6 changes: 3 additions & 3 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ android {
applicationId "cc.shinichi.bigimageviewpager"
minSdkVersion 24
targetSdkVersion 33
versionCode 813
versionName "androidx-8.1.3"
versionCode 820
versionName "androidx-8.2.0"
signingConfig signingConfigs.debug
multiDexEnabled true
}
Expand Down Expand Up @@ -78,6 +78,6 @@ dependencies {
implementation "androidx.media3:media3-ui:1.4.1"

// library
// implementation 'com.github.SherlockGougou:BigImageViewPager:androidx-8.1.3'
// implementation 'com.github.SherlockGougou:BigImageViewPager:androidx-8.2.0'
implementation project(':library')
}

0 comments on commit 66ed18a

Please sign in to comment.