ExoMedia is a media playback library with similar APIs to the Android MediaPlayerand VideoView that uses the ExoPlayer as a backing when possible,otherwise the default Android MediaPlayer and VideoView are used.
The ExoPlayer is only supported on devices that pass the compatibility Test Suiteand that are JellyBean (API 16) or greater. The ExoPlayer providesadditional support for streaming (HLS, DASH, etc.) and full HD (1080p +)
The ExoMedia website can be found here
The ExoMedia documentation website can be found on the website linked above or here
The latest AAR (Android Archive) files can be downloaded from JCenter
Or included in your gradle dependencies
repositories {
jcenter()
}
dependencies {
implementation 'com.devbrackets.android:exomedia:5.0.0'
}
The ExoMedia VideoView can be added in your layout files like any other Android view.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.devbrackets.android.exomedia.ui.widget.VideoView
android:id="@+id/video_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:useDefaultControls="true"/>
</RelativeLayout>
While in your Activity or Fragment you treat it like a standard Android VideoView
private VideoView videoView;
private void setupVideoView() {
// Make sure to use the correct VideoView import
videoView = (VideoView)findViewById(R.id.video_view);
videoView.setOnPreparedListener(this);
//For now we just picked an arbitrary item to play
videoView.setVideoURI(Uri.parse("https://archive.org/download/Popeye_forPresident/Popeye_forPresident_512kb.mp4"));
}
@Override
public void onPrepared() {
//Starts the video playback as soon as it is ready
videoView.start();
}
Copyright 2015-2021 ExoMedia Contributors
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.
写在前面的话 对App视频播放模块进行扩展,需要自定义播放器的样式、监听视频播放过程中各种事件(播放开始、暂停、重新播放、结束、拖拽进度条、横竖屏切换等)、横竖屏切换、手动控制播放进度等。 自定义功能性、扩展性较好的视频播放模块。初次技术选型时利用github上比较流行的JieCaoVideoPlayer进行二次开发,基本实现了功能需求,但缺点也比较明显:1.机型及视频兼容性差,2.扩展性不佳,3
说明 视频播放事件包括两个部分:1.播放器本身的事件(开始、暂停、结束播放等) 2.用户动作触发的事件(拖拽进度条、点击屏幕等) 播放事件监听的途径主要是通过视频播放框架(或开发者自定义)的控制器来实现的。 控制器是指操作播放器的组件(按钮、进度条等)的容器。 事件的监听经常与视频当前时间配合使用。 本文基于Exoplayer+Exomedia实现视频事件监听。 关键点 VideoView与视频时
转载自:https://blog.csdn.net/xunshishi/article/details/74171321 写在前面的话 对App视频播放模块进行扩展,需要自定义播放器的样式、监听视频播放过程中各种事件(播放开始、暂停、重新播放、结束、拖拽进度条、横竖屏切换等)、横竖屏切换、手动控制播放进度等。 自定义功能性、扩展性较好的视频播放模块。初次技术选型时利用github上比较流行的J
转载自:https://blog.csdn.net/xunshishi/article/details/74171379 说明 视频播放事件包括两个部分:1.播放器本身的事件(开始、暂停、结束播放等) 2.用户动作触发的事件(拖拽进度条、点击屏幕等) 播放事件监听的途径主要是通过视频播放框架(或开发者自定义)的控制器来实现的。 控制器是指操作播放器的组件(按钮、进度条等)的容器。 事件的监听经常与