百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
F

fullscreen-video-view

> 开发工具
开源

=== FullscreenVideoView 是一个自定义的 VideoView Android 库,可轻松加载、设置和全屏显示视频视图。请参阅…

100 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

=== FullscreenVideoView 是一个自定义的 VideoView Android 库,可轻松加载、设置和全屏显示视频视图。请参阅…

=== FullscreenVideoView is a custom VideoView Android library which makes loading, setting up and going fullscreen for video views easy.

Download

gradle
dependencies {
    ...
    implementation 'bg.devlabs:fullscreen-video-view:1.2.0'
}

How to use FullscreenVideoView?

Declare the FullscreenVideoView in the XML layout file

xml

    

The Activity where the FullscreenVideoView is declared should handle configuration changes, which imposes this change in the AndroidManifest.xml file

xml

Network security configuration on Android API 23 or later

On devices with Android API 23 or later a network security configuration should be set up to allow the cleartext traffic.

  • Add the XML tag android:usesCleartextTraffic="true" in the application tag in AndroidManifest.xml.
  • Add a network_security_config.xml file in the res/xml directory and add the domains that you want to use in your application. To use this network configuration it must be added in the application tag in AndroidManifest.xml (android:networkSecurityConfig="@xml/network_security_config).

Basic video loading (from URL or from a file)

kotlin
// Loading from URL
override fun onCreate(savedInstanceState: Bundle?) {
	...
	val fullscreenVideoView = findViewById(R.id.fullscreenVideoView)
	val videoUrl = "https://clips.vorwaerts-gmbh.de/VfE_html5.mp4"
	fullscreenVideoView.videoUrl(videoUrl)
}

// Loading from file
override fun onCreate(savedInstanceState: Bundle?) {
	...
	val fullscreenVideoView = findViewById(R.id.fullscreenVideoView)
	val videoFile = new File("file_path")
	fullscreenVideoView.videoFile(videoFile)
}

Change controls drawable resources

Java or Kotlin

kotlin
fullscreenVideoView.videoUrl(videoUrl)
        .playDrawable(R.drawable.ic_play)
        .pauseDrawable(R.drawable.ic_pause)
        .fastForwardDrawable(R.drawable.ic_fast_forward)
        .rewindDrawable(R.drawable.ic_rewind)
        .enterFullscreenDrawable(R.drawable.ic_fullscreen)
        .exitFullscreenDrawable(R.drawable.ic_fullscreen_exit)

XML

xml

Enable/disable controls

kotlin
fullscreenVideoView.videoUrl(videoUrl)
        .disablePause()
        .addSeekBackwardButton()
        .addSeekForwardButton()

Enable video auto-start

kotlin
fullscreenVideoView.videoUrl(videoUrl)
        .enableAutoStart()

Customize fast-forward and/or rewind seconds

kotlin
fullscreenVideoView.videoUrl(videoUrl)
        .fastForwardSeconds(5)
        .rewindSeconds(5)

Change the playback speed (only for API 23 and above)

There are 7 playback speed values which are added by default, but they can be changed with custom ones when playbackSpeedOptions is used.

kotlin
val playbackOptions = PlaybackSpeedOptions().addSpeeds(0.25f, 0.5f, 0.75f, 1f)

fullscreenVideoView.videoUrl(videoUrl)
        .addPlaybackSpeedButton()
        .playbackSpeedOptions(playbackOptions)

Add thumbnail

This feature supports loading only drawables from the Android project.

kotlin
val thumbnailResId = R.drawable.video_thumbnail

fullscreenVideoView.videoUrl(videoUrl)
	.thumbnail(thumbnailResId)

Play/Pause video programmatically

If you want to play/pause the video programmatically you can use the play()/pause() method.

kotlin
fullscreenVideoView.play()
// OR
fullscreenVideoView.pause()

Hide progress views

Hiding the progress views can be implemented initially from calling the Builder function or later by calling the view method.

kotlin
// Hide initially from the Builder
fullscreenVideoView.videoUrl(videoUrl)
        .hideProgress()

// OR

// Hide by calling the view method
fullscreenVideoView.hideProgress()

Hide fullscreen button

Hiding the fullscreen button can be implemented initially from calling the Builder function or later by calling the view method.

kotlin
// Hide initially from the Builder
fullscreenVideoView.videoUrl(videoUrl)
        .hideFullscreenButton()

// OR

// Hide by calling the view method
fullscreenVideoView.hideFullscreenButton()

Listen for errors

Listening for errors can be implemented initially from calling the Builder function or later by calling the view method.

kotlin
// Add initially from the Builder
fullscreenVideoView.videoUrl(videoUrl)
        .addOnErrorListener(object : OnErrorListener {
                override fun onError(exception: FullscreenVideoViewException?) {
                        // Handle error
                }        
        })
        
// OR

// Add by calling the view method
fullscreenVideoView.addOnErrorListener(object : OnErrorListener {
        override fun onError(exception: FullscreenVideoViewException?) {
                // Handle error
        }    
})

Listen for Media Controller events

To listen for Media Controller events you should use the Builder function mediaControllerListener. You can either pass the MediaControllerListener interface or MediaControllerListenerAdapter if don't need to use all of the methods of the interface.

…

Seek to position

Seek to a selected position by calling the seekTo method and passing the time in milliseconds to it.

fullscreenVideoView.videoUrl(videoUrl)
	.seekTo(5000)

Change the video URL at runtime

Change the video URL by calling changeUrl method of FullscreenVideoView and passing the new URL.

fullscreenVideoView.changeUrl(videoUrl)

Listen for video completion

Listen for video completion event by calling the addOnVideoCompletedListener and passing an instance of OnVideoCompletedListener.

fullscreenVideoView.addOnVideoCompletedListener {
    // Do something when the video is completed
}

Compatibility

  • Minimum Android SDK: API level 19
  • Compile Android SDK: API level 29

Known issues

There is a memory leak in Android 7 (API levels 24 and 25), which is known and listed in the LeakCanary repository issues.

License

Copyright 2017 Dev Labs

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Javaandroidfullscreenuivideoview

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类开发工具
定价开源

> 相关工具

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具