I am using below video player library and have to play video from local url.
Library is here : https://github.com/halilozercan/BetterVideoPlayer
I have done :
private lateinit var mVv_gym_toor_video: BetterVideoPlayer
vv_gym_gallery_video.setSource(Uri.fromFile(file))
vv_gym_gallery_video.start()
I am getting /storage/emulated/0/MyApp/Media/media_683c42.mp4 in file
In XML, I have taken as below :
<com.halilibo.bvpkotlin.BetterVideoPlayer
app:bvp_showBottomProgressBar="false"
android:id="@+id/vv_gym_gallery_video"
android:layout_width="match_parent"
android:layout_height="@dimen/dimen_200"
app:bvp_autoPlay="false"
app:bvp_disableControls="false"
app:bvp_hideControlsOnPlay="true"
app:bvp_pauseDrawable="@drawable/bvp_action_pause"
app:bvp_playDrawable="@drawable/bvp_action_play"
app:bvp_restartDrawable="@drawable/bvp_action_restart"
app:bvp_captionSize="22sp"
app:bvp_captionColor="@color/color_app_theme_dark"
app:bvp_gestureType="SwipeGesture"
app:bvp_loop="false" />
But, getting below error :
Caused by: java.util.UnknownFormatConversionException: Conversion = 'P'
at java.util.Formatter$FormatSpecifier.conversion(Formatter.java:2781)
at java.util.Formatter$FormatSpecifier.<init>(Formatter.java:2811)
at java.util.Formatter$FormatSpecifierParser.<init>(Formatter.java:2624)
at java.util.Formatter.parse(Formatter.java:2557)
at java.util.Formatter.format(Formatter.java:2504)
at java.util.Formatter.format(Formatter.java:2458)
at java.lang.String.format(String.java:2770)
at com.halilibo.bvpkotlin.BetterVideoPlayer$Companion.log(BetterVideoPlayer.kt:1072)
at com.halilibo.bvpkotlin.BetterVideoPlayer$Companion.access$log(BetterVideoPlayer.kt:1064)
at com.halilibo.bvpkotlin.BetterVideoPlayer.prepare(BetterVideoPlayer.kt:480)
at com.halilibo.bvpkotlin.BetterVideoPlayer.setSource(BetterVideoPlayer.kt:372)
at com.gymowner.ui.my_gym.fragments.GymGalleryFragment.onActivityResult(GymGalleryFragment.kt:437)
at androidx.fragment.app.FragmentActivity.onActivityResult(FragmentActivity.java:170)
at android.app.Activity.dispatchActivityResult(Activity.java:7276)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4264)