exoplayer2.x

In ExoPlayer, how exactly to use SimpleExoPlayer.setVideoScalingMode to be like in ImageView center-crop?

天涯浪子 提交于 2019-12-11 06:04:38
问题 Background I'm trying to have a video shown in center-crop manner (like on ImageView). I also hope I can find how to scale in other ways, as done on this library. The problem I use this for this purpose : player!!.videoScalingMode = C.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING But for some reason it doesn't do center-cropping. What I've tried Looking at the docs, I see this: "Note that the scaling mode only applies if a MediaCodec-based video Renderer is enabled and if the output surface

Playback error on using ClearKey DRM Schema in Exoplayer 2 android

杀马特。学长 韩版系。学妹 提交于 2019-12-11 06:02:06
问题 I am trying to play the .MPD file, which is using DRMSchema : clearKey For playing it i am creating a DefaultDrmSessionManager in the following way String keyString = "{\"keys\":[{\"kty\":\"oct\",\"k\":\"y1QQhMmXMa70__dFAMEurQ\n" + " \",\"kid\":\"bXbyXLF_Xha46u9rv1gtjg\n" + " \"},{\"kty\":\"oct\",\"k\":\"pGMaFTpEPfnu0FkwQ9t1GQ\n" + " \",\"kid\":\"88XgNh5mVLKPgEnHeLI5Rg\n" + " \"}],'type':\"temporary\"}"; LogMgr.i("DRMCallback JSON : " + keyString); drmCallback = new LocalMediaDrmCallback

How to add Adaptive Track Selector in Exo-player v2.x?

北城以北 提交于 2019-12-10 22:19:41
问题 I'm setting up Exo Player in my app and I have implemented DASH adaptive streaming in my player, and want to add the functionality to play the track of specific quality selected by the user. My Exo player version is 2.9.3 , I tried implementing by following these Stackoverflow Post,Medium Post, but it's bit confusing and some part of the code is deprecated, and saying the truth is that I am a beginner. Here's my code for initializing the player:- private void initializePlayer() { if (player =

Exoplayer playback error after interstitial ad

半城伤御伤魂 提交于 2019-12-10 12:46:40
问题 I am playing video with ExoPlayer and showing Google AdMob interstitial ad. After ad has been gone there was trouble to play video and show error like: Playback error.com.google.android.exoplayer2.ExoPlaybackException at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.throwDecoderInitError(MediaCodecRenderer.java:441) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodec(MediaCodecRenderer.java:428) at com.google.android.exoplayer2.mediacodec

How to use TextureView instead of SurfaceView with PlayerView of ExoPlayer?

核能气质少年 提交于 2019-12-10 09:44:09
问题 I know it is possible to use TextureView in ExoPlayer. But I cannot find any sample on how to implement this functionality in a proper way. Could you please help me on this issue? 回答1: The PlayerView has an xml attribute surface_type which let's you choose whether you want to use a SurfaceView or a TextureView . (Note: SimpleExoPlayerView has been renamed to PlayerView in recent versions since it only depends on the Player interface and not on SimpelExoPlayerView anymore.) You can choose

How to hide control buttons in ExoPlayer2

廉价感情. 提交于 2019-12-10 00:45:42
问题 How to hide all controllers in ExoPlayer2 (start button, pause, and so on) that they did not exist, and the screen was always full. I looked, there is simpleExoPlayerView.setUseController(true) method; But it deactivate the player ... public void setUseController (boolean useController) { this.useController = useController; if (useController) { controller.setPlayer(player); } else { controller.hide(); controller.setPlayer(null); } } How to hide or delete these components? 回答1: ExoPlayer-r2.2

How to catch all errors for ExoPlayer?

回眸只為那壹抹淺笑 提交于 2019-12-08 17:07:10
问题 I implemented ExoPlayer as player for my application. But I can´t find out how to catch all ExoPlayer errors to avoid app crash. I added following listener, but it doesn´t catch all errors. I have to use DRM and it sometimes crash on some problem with it, but I can´t set listener before, because player is NULL. player = ExoPlayerFactory.newSimpleInstance(context, trackSelector, loadControl, drmSessionManager); player.addListener(new ExoPlayer.EventListener() { @Override public void

How to show ads at specific points using ExoPlayer's IMA extension?

不羁的心 提交于 2019-12-05 07:41:46
问题 I am using ExoPlayer 2.7.3 with IMA extension. I have to show ads at certain intervals. I have managed to integrate the AdsLoader and AdsMediaSource . I am receiving and displaying the ads. But the ads are only appearing at the beginning of the movie. How do I make the ads to be shown at the points when I want them to (for eg. at every 30 minutes)? 回答1: I'm not sure whether you are using the IMA extension with the ImaAdsLoader or your custom implementation of AdsLoader which is part of the

Get everything in from ExoPlayer Cache

泪湿孤枕 提交于 2019-12-05 04:09:28
问题 Using https://google.github.io/ExoPlayer/doc/reference/com/google/android/exoplayer2/upstream/cache/CacheDataSourceFactory.html is there a way to grab all the MediaSources that have been cached? 回答1: The Cache offers no convenient API to get all completely cached URIs or similar. If you create your own CacheEvictor (for instance by wrapping a LeastRecentlyUsedCacheEvictor) you can do your own book keeping when spans are added or removed and then delegate to the LRUCacheEvictor. This way you

ExoPlayer2 - How can I make a HTTP 301 redirect work?

对着背影说爱祢 提交于 2019-12-04 17:12:40
问题 I started using ExoPlayer to stream some audio. All was well until I came across an URL that has a "301 Moved Permanently" redirect. ExoPlayer2 does not handle that by default. I've already seen this thread: https://github.com/google/ExoPlayer/issues/423 There they say to add the new "allowCrossDomainRedirects" flag to either a HttpDataSource or UriDataSource. The problem is that I don't use either of those classes: //I am NOT using SimpleExoPlayer because I need a different renderer.