Open devingDev opened 6 years ago
i have the same in this line img_playback.setImageResource(R.drawable.ic_pause);
Did you try this on a real device? Because it seems to happen only on older emulator versions. On android 4.2.2 a real device it worked !
Also your code shoulnt cause the mediaplayer to fail with that error code 🤔
Trying out my app on older versions for compat check I saw that it does not play videos. The thumbnail gets hidden once the video is about to start to play.
some errors I saw in logcat : `E/BufferQueue: [unnamed-3021-1] setDefaultBufferSize: dimensions cannot be 0 (w=0, h=0)
E/MediaPlayer: error (1, -2147483648)
E/MediaPlayer: Should have subtitle controller already set Error (1,-2147483648)
E/MediaPlayer: start called in state 0
W/System.err: android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:6094) at android.view.ViewRootImpl.invalidateChildInParent(ViewRootImpl.java:857) at android.view.ViewGroup.invalidateChild(ViewGroup.java:4320) at android.view.View.invalidate(View.java:10935) at android.view.View.setFlags(View.java:8916) at android.view.View.setVisibility(View.java:6036) at android.widget.ImageView.setVisibility(ImageView.java:1226) at com.allattentionhere.autoplayvideos.AAH_CustomViewHolder.videoStarted(AAH_CustomViewHolder.java:36) at com.myapp.deving.Adapter.MyVideosAdapter$MyViewHolder.videoStarted(MyVideosAdapter.java:99) at com.allattentionhere.autoplayvideos.AAH_CustomViewHolder$1.call(AAH_CustomViewHolder.java:51) at com.allattentionhere.autoplayvideos.AAH_CustomViewHolder$1.call(AAH_CustomViewHolder.java:48) at com.allattentionhere.autoplayvideos.AAH_CustomVideoView.startVideo(AAH_CustomVideoView.java:72) at com.allattentionhere.autoplayvideos.AAH_CustomViewHolder.playVideo(AAH_CustomViewHolder.java:32) at com.allattentionhere.autoplayvideos.AAH_CustomRecyclerView$2.run(AAH_CustomRecyclerView.java:139) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.os.HandlerThread.run(HandlerThread.java:61)
E/MediaPlayer: Error (-38,0)`
I only tested with API 27 before so not sure why its doing this. Edit: Gonna try API 21 next Edit2: Same on API 21 .. nothing plays only those errors in log