exoplayer

Android 使用ExoPlayer视频播放 (一)

匿名 (未验证) 提交于 2019-12-03 00:27:02
ExoPlayer是google开源的应用级媒体播放器项目,目前已有1W+的start,并一直在维护。该开源项目包含ExoPlayer库和演示 demo,github地址: https://github.com/google/ExoPlayer 。 与Android内置的MediaPlayer相比,ExoPlayer具有许多优点: *支持通过HTTP(DASH)和SmoothStreaming进行动态自适应流,这两种都不受MediaPlayer的支持。还支持许多其他格式 *能够自定义和扩展播放器,以适应各种不同需求。 ExoPlayer专门设计了这一点,大部分组件都可以自己替换 *官网说了很多,其实说到底最主要的就是各个组件可以自定义,还可以接入ffmpeg组件,基本能满足99.9%的需求 与IJKPlayer和Vitamio相比,ExoPlayer具有的优点: *导入项目之后APK体积增加小 缺点: *最低支持版本4.4 *实现比较复杂 ExoPlayer库的核心是Exoplayer接口,Exoplayer公开了传统的高级媒体播放器功能,例如缓冲媒体、播放、 暂停和seek等功能,ExoPlayer通过组件实现替他高级功能。ExoPlayer公同的组件有: *MediaSource:定义多媒体数据源,从Uri中读取数据,传入ExoPlayer。 *TrackSelector

exoplayer实测播放dash流(二) dash+drm widevine加密流

匿名 (未验证) 提交于 2019-12-03 00:19:01
一、前提 exoplayer的集成和使用一 二、相关API的调用 public class MyApplication extends Application { protected String userAgent; @Override public void onCreate() { super.onCreate(); userAgent = Util.getUserAgent(this, "ExoPlayer2018"); } public DataSource.Factory buildDataSourceFactory(TransferListener<? super DataSource> listener) { return new DefaultDataSourceFactory(this, listener, buildHttpDataSourceFactory(listener)); } public HttpDataSource.Factory buildHttpDataSourceFactory(TransferListener<? super DataSource> listener) { return new DefaultHttpDataSourceFactory(this.userAgent, listener); } } public class

exoplayer的使用简介和实测播放dash流、hls(一)

匿名 (未验证) 提交于 2019-12-03 00:18:01
一、exoplayer的相关库的集成关联 From JCenter 本人的是as3.1。我这里的exo库用的是2.8.0。取消其他版本的点这里: 历代exoplayer-release版本简介 。 git clone https://github.com/google/ExoPlayer.git git checkout release-v2 include ':app', ':library', ':library-dash', ':lib100' gradle.ext.exoplayerRoot = 'E:\\exo player\\ExoPlayer-release-v2' gradle.ext.exoplayerModulePrefix = 'exoplayer-' apply from: new File(gradle.ext.exoplayerRoot, 'core_settings.gradle') implementation project(':exoplayer-library-core') implementation project(':exoplayer-library-dash') implementation project(':exoplayer-library-ui') 二、exoplayer的使用。 <?xml version="1.0"

ExoPlayer cache

别说谁变了你拦得住时间么 提交于 2019-12-02 22:05:45
I'm traying to use ExoPlayer for playback video over http. And I want to save video after video was loaded and play it from cache. How Do implement cache and playback from cache? Can give me any samples. You use cacheDataSource created using cache and dataSource. This cacheDataSource is then used by ExtractorSampleSource.Below is the code for audioRenderer, similarly can be done for videoRender; passing to exoplayerInstance.prepare(renderers). Cache cache = new SimpleCache(mCtx.getCacheDir(), new LeastRecentlyUsedCacheEvictor(1024 * 1024 * 10)); DataSource dataSource = new DefaultUriDataSource

YouTube video playback with ExoPlayer [closed]

喜夏-厌秋 提交于 2019-12-02 17:28:43
I am interested in using the ExoPlayer for YouTube video playback. I see from the ExoPlayer samples that they play YouTube videos via DASH URLs. I'm using the Android YouTube API to search for videos, and don't see a means for obtaining a DASH URL for any of the search results. Is someone aware of any samples for integrating the YouTube API (v3) with the ExoPlayer (without using hardcoded video urls), or know of a way to get the information I need from the YouTube API to load the video into the ExoPlayer? PeDuCKA For getting DASH URL, you need to download file: http://www.youtube.com/get_video

How to show mini controller at bottom or persistent media controls like spotify or Google music in whole application [closed]

筅森魡賤 提交于 2019-12-01 15:59:17
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . I'm developing an app that can play video from youtube or other live streaming, if a user pressed back/home button, a user can hear the audio only and then they can back to see the video again. I have created a service that holds player and does all things. In my whole application

How to add Listener for next , previous , rewind and forward in Exoplayer

余生长醉 提交于 2019-12-01 02:58:06
问题 I am working on ExoPlayer, I want to customize the ExoPlayer and listen for the Event next, previous, rewind, forward so that when the user clicks the next button next video in the Playlist will be playing and when using previous the previous video in the playlist will be playing and so on. I am using the Custom Layout, it changes the design but not listen for these events(next, previous etc). here is my code:- <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns

Extracting metadata from Icecast stream using Exoplayer

瘦欲@ 提交于 2019-12-01 01:25:07
Since switching from Mediaplayer to a simple implementation Exoplayer I have noticed much improved load times but I'm wondering if there is any built in functionality such as a metadata change listener when streaming audio? I have implemented Exoplayer using a simple example as below: Uri uri = Uri.parse(url); DefaultSampleSource sampleSource = new DefaultSampleSource(new FrameworkSampleExtractor(context, uri, null), 2); TrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource); mExoPlayerInstance.prepare(audioRenderer); mExoPlayerInstance.setPlayWhenReady(true); I have an

ExoPlayer stops playing in background

拜拜、爱过 提交于 2019-11-30 21:24:37
I have an application that keeps a global instance of an ExoPlayer instance to facilitate audio streams in the background. After opening lots of apps, the audio stops playing. It happens as follows: open Activity that starts playing audio press back button to close Activity the audio is still playing and keeps doing so if you leave the device alone (as intended) However, when you open a dozen or more apps after the last step, the ExoPlayer stops playing at some point. My guess is that a memory cleanup happens and thus ExoPlayer gets deallocated. I tried to get more information from the logs,

Extracting metadata from Icecast stream using Exoplayer

随声附和 提交于 2019-11-30 19:25:25
问题 Since switching from Mediaplayer to a simple implementation Exoplayer I have noticed much improved load times but I'm wondering if there is any built in functionality such as a metadata change listener when streaming audio? I have implemented Exoplayer using a simple example as below: Uri uri = Uri.parse(url); DefaultSampleSource sampleSource = new DefaultSampleSource(new FrameworkSampleExtractor(context, uri, null), 2); TrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer