ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

android – 如何在Exoplayer中为next,previous,rewind和forward添加Listener

2019-07-01 20:15:00  阅读:212  来源: 互联网

标签:android listener controls exoplayer


我正在使用ExoPlayer,我想自定义ExoPlayer并听取下一个,上一个,倒带,前进的事件,这样当用户点击下一个按钮时播放列表中的下一个视频将播放,并且当使用之前的前一个视频时播放列表将播放等等.我正在使用自定义布局,它会更改设计但不会监听这些事件(下一个,上一个等).这是我的代码: –

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true">


<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="200dp">

    <com.google.android.exoplayer2.ui.SimpleExoPlayerView
        android:id="@+id/player_view"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        app:resize_mode="fill"
        app:controller_layout_id="@layout/custom_controls"
        app:player_layout_id="@layout/custom_player_view"
        app:surface_type="texture_view"/>

    <ProgressBar
        android:id="@+id/progressBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:visibility="gone"/>
</RelativeLayout>




<android.support.v7.widget.RecyclerView
    android:id="@+id/recycler_view"
    android:layout_marginTop="220dp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

我在ConcatenatingMediaSource中添加了Mediasource列表.它正在工作,但我也要更改布局,这就是为什么我需要一个侦听器来为ExoPlayer中的每个控件.我看到这个link.所以每当用户点击ExoPlayer中的下一个,上一个,倒回,前进按钮时,我就知道onPositionDiscontinuity()方法调用但是我想要每个按钮的监听器,这样我才能执行相应的操作?

谢谢

解决方法:

我使用这个link为前一个,下一个等自定义ExoPlayer.您可以实现自己的逻辑来跟踪所有这些事件.这个对我有用.

标签:android,listener,controls,exoplayer
来源: https://codeday.me/bug/20190701/1350055.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有