exoplayer

ExoPlayer reading mp3 file from raw folder

荒凉一梦 提交于 2019-12-07 13:56:10
问题 Is there any possibility to set an mp3 file that's located in the app's raw folder to ExoPlayer? I tried to achieve it with the following code snippet without success unfortunately: mMediaPath = "android.resource://" + getPackageName() + File.separator + R.raw.ringtone; Any help is greatly appreciated! 回答1: It's possible to load files from the raw folder, the key is to use RawSourceDataSource . Here's an example(in Kotlin) to create a LoopingMediaSource for an mp3file in the raw directory:

Exoplayer player video mp4 e stream m3u8

巧了我就是萌 提交于 2019-12-07 09:35:30
Is there a way to run an exoplayer with both mp4 and stream m3u8 videos? I tried but I could not find a solution. I found the following sources for testing. Video mp4: here Stream m3u8: here This is the code I wrote with the mp4 videos works, but with m3u8, no. I made several attempts, but I did not succeed, I was thinking of using HlsMediaSource but I could not make it work. Error, the following function is called within SimpleVideoStream.java : public void onPlayerError(ExoPlaybackException error) { Code: AndroidManifest: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http:/

ExoPlayer: How to play http live stream?

左心房为你撑大大i 提交于 2019-12-07 09:32:14
问题 i want to use ExoPlayer library for my Android application to play live streaming videos. I was looking through the exoplayer website and documentation as well as Github page but i wasn't satisfied with the explanations. Anyone can give me a hint how do you play a http live streaming video through ExoPlayer? Thanks in advance. 回答1: I was able to play LiveStream right away in ExoPlayer. Just download this sample at https://drive.google.com/file/d/0Byr1H33Pe7u-MW93UUpmMUhGTTQ/view and modify

Textureview get Surface

半世苍凉 提交于 2019-12-07 02:49:14
问题 I am using the ExoPlayer Library, which expects a Surface, however i couldn't find any Method, which retrieves the underlying Surface of the Textureview. Any Ideas? The Surfaceview has a method for that: surfaceView.getHolder().getSurface() Or is there no surface in TextureView? 回答1: First step is to get the SurfaceTexture from the TextureView using the getSurfaceTexture() member function. SurfaceTexture surfaceTexture = textureView.getSurfaceTexture(); Then create the Surface object from the

how to stream rtsp url using exoplayer?

£可爱£侵袭症+ 提交于 2019-12-07 01:24:58
问题 I want to stream rtsp video using exoplayer. I am using ExoMedia library which is an An Android ExoPlayer wrapper. I have search on stackoverflow but I didn't find any good answer. After some google search I found that exoplayer does not support rtsp stream issue 55. Is there any way to stream rtsp url using exoplayer? Here is my code. public class MainActivity extends AppCompatActivity implements OnPreparedListener{ EMVideoView emPlayer; @Override protected void onCreate(Bundle

Connecting exoplayer with MediaSessionCompat

喜你入骨 提交于 2019-12-06 11:05:12
I want to connect my implementation of exoplayer with the media session object. I set up a SimpleExoPlayerView to show a video. Every time a button is clicked, I want the media session callbacks to fire. I can only get the callbacks to fire when something like a pair of headphones is used. The code used in the app is written below @OnLifecycleEvent(Lifecycle.Event.ON_CREATE) public void setUp(LifecycleOwner lifecycleOwner){ // Create a MediaSessionCompat Log.i("Hoe8", "lco setup called"); mMediaSession = new MediaSessionCompat(activity, "this"); // Enable callbacks from MediaButtons and

Stop audio playing when another app's audio comes in

≡放荡痞女 提交于 2019-12-06 10:28:44
I would like to know how do I implement the behaviour, so that my radio streaming would stop playing if other audio would come in to play - for instance, user starts playing music, makes a call etc. In other words, how does my ExoPlayers knows that other audio is being played, or if it doesn't, do I have to listen for mediaplayer and call events? Here is an example i made for an audio state manager , you can use it as a template. (created in 2016) As per the question - You need to use an OnAudioFocusChangeListener , Read the comments in the example: public class AudioStateManager { private

Android stream over ExoPlayer

微笑、不失礼 提交于 2019-12-06 09:20:46
I am trying to switch from MediaPlayer in favor of ExoPlayer but I can't find any updated demo how can I use it.I think they have removed the FrameworkSampleSource method. I downloaded the demo from Github but I can't find the implementation of player, I could find the Samples object where the URLs are added. I have a list of URL's that I want to be played.I am switching to ExoPlayer because it's smoother than MediaPlayer.I have read all StackOverflow topics about ExoPlayer but none of them are updated. Can anyone give me an example how can implement it? Thank you. FrameworkSampleSource source

How to design custom seekbar and volume control for ExoPlayer in Android

為{幸葍}努か 提交于 2019-12-06 05:16:05
I have tried this and this for Design Custom Seekbar for ExoPlayer but no luck. I want to design custom thumb and ProgressBar for ExoPlayer. Following is the XML for ExoPlayer where I've tried to put seekbar but it's not coming as expected. <com.google.android.exoplayer.AspectRatioFrameLayout android:id="@+id/video_frame" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center"> <SurfaceView android:id="@+id/surface_view" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center"/> <View android:id="@

ExoPlayer reading mp3 file from raw folder

偶尔善良 提交于 2019-12-06 00:32:13
Is there any possibility to set an mp3 file that's located in the app's raw folder to ExoPlayer? I tried to achieve it with the following code snippet without success unfortunately: mMediaPath = "android.resource://" + getPackageName() + File.separator + R.raw.ringtone; Any help is greatly appreciated! It's possible to load files from the raw folder, the key is to use RawSourceDataSource . Here's an example(in Kotlin) to create a LoopingMediaSource for an mp3file in the raw directory: val uri = RawResourceDataSource.buildRawResourceUri(R.raw.mp3file) val dataSource = RawResourceDataSource(this