ayalus / exoplayer-2-example Goto Github PK
View Code? Open in Web Editor NEWAndroid example apps
Android example apps
Hi, everytime i put a playlist on your example, keep playing the lowest resolution available on the m3u8. Do you have any ideas any?
Hi,
Can you please me to implement quality button and below pasted clde.
(Util.inferContentType(Uri.parse(mUrl))) {
C.TYPE_HLS -> {
val mediaSource = HlsMediaSource.Factory(dataSourceFactory).createMediaSource(Uri.parse(mUrl))
player.prepare(mediaSource)
}
C.TYPE_OTHER -> {
val mediaSource = ExtractorMediaSource.Factory(dataSourceFactory).createMediaSource(Uri.parse(mUrl))
player.prepare(mediaSource)
}
else -> {
//This is to catch SmoothStreaming and DASH types which are not supported currently
setResult(Activity.RESULT_CANCELED)
finish()
}
}
Hi, I am developing an android app using this library I need to play certain video formats. But it works with mp4 and other formats but m3u8 format always generates an error. I used the below given code. Please reply asap. Thank you in advance!!
Code used :
Uri mp4VideoUri =Uri.parse("m3u8 link");
final MediaSource videoSource = new HlsMediaSource(mp4VideoUri, dataSourceFactory,
1,mainHandler,null);
final LoopingMediaSource loopingSource = new LoopingMediaSource(videoSource);
Error genearated :
07-28 11:51:41.530 32038-32038/com.ayalus.exoplayer2example E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.ayalus.exoplayer2example, PID: 32038
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/exoplayer2/source/AdaptiveMediaSourceEventListener$EventDispatcher;
at com.google.android.exoplayer2.source.hls.HlsMediaSource.(HlsMediaSource.java:78)
at com.google.android.exoplayer2.source.hls.HlsMediaSource.(HlsMediaSource.java:68)
at com.ayalus.exoplayer2example.MainActivity.onCreate(MainActivity.java:175)
at android.app.Activity.performCreate(Activity.java:6666)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2706)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2818)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1541)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6320)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1085)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:946)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.exoplayer2.source.AdaptiveMediaSourceEventListener$EventDispatcher" on path: DexPathList[[zip file "/data/app/com.ayalus.exoplayer2example-2/base.apk", zip file "/data/app/com.ayalus.exoplayer2example-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.ayalus.exoplayer2example-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.ayalus.exoplayer2example-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.ayalus.exoplayer2example-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.ayalus.exoplayer2example-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.ayalus.exoplayer2example-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.ayalus.exoplayer2example-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.ayalus.exoplayer2example-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.ayalus.exoplayer2example-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.ayalus.exoplayer2example-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.ayalus.exoplayer2example-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.ayalus.exoplayer2example-2/lib/arm64, /system/lib64, /vendor/lib64, /system/vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.google.android.exoplayer2.source.hls.HlsMediaSource.(HlsMediaSource.java:78)
at com.google.android.exoplayer2.source.hls.HlsMediaSource.(HlsMediaSource.java:68)
at com.ayalus.exoplayer2example.MainActivity.onCreate(MainActivity.java:175)
at android.app.Activity.performCreate(Activity.java:6666)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2706)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2818)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1541)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6320)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1085)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:946)
I'm trying to run the code and getting this error for every stream
E/ExoPlayerImplInternal: Source error.
com.google.android.exoplayer2.upstream.HttpDataSource$HttpDataSourceException: Unable to connect to http://live.field59.com/wwsb/ngrp:wwsb1_all/playlist.m3u8
at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:194)
at com.google.android.exoplayer2.upstream.DefaultDataSource.open(DefaultDataSource.java:147)
at com.google.android.exoplayer2.upstream.DataSourceInputStream.checkOpened(DataSourceInputStream.java:102)
at com.google.android.exoplayer2.upstream.DataSourceInputStream.open(DataSourceInputStream.java:65)
at com.google.android.exoplayer2.upstream.ParsingLoadable.load(ParsingLoadable.java:137)
at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:320)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.io.IOException: Cleartext HTTP traffic to live.field59.com not permitted
at com.android.okhttp.HttpHandler$CleartextURLFilter.checkURLPermitted(HttpHandler.java:115)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:458)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:127)
at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.makeConnection(DefaultHttpDataSource.java:429)
at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.makeConnection(DefaultHttpDataSource.java:350)
at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:192)
at com.google.android.exoplayer2.upstream.DefaultDataSource.open(DefaultDataSource.java:147)
at com.google.android.exoplayer2.upstream.DataSourceInputStream.checkOpened(DataSourceInputStream.java:102)
at com.google.android.exoplayer2.upstream.DataSourceInputStream.open(DataSourceInputStream.java:65)
at com.google.android.exoplayer2.upstream.ParsingLoadable.load(ParsingLoadable.java:137)
at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:320)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
I am simply trying to rotate the relative layout which contains the exoplayer , but when the relative layout is rotated the video doesnot play.
I have put up the code I am trying and the detailed question
at
https://stackoverflow.com/questions/47028127/video-doesnot-play-when-we-rotate-relativelayout-containing-exoplayer
how can we just rotate the relative layout and still play the video
I Used this code and it works, i play a live stream m3u8 , but the video quality is too poor !
Is there any method to make play in HD ?
Hi example helped me with my first demo app 3 years now i have a fully working app for android tv however i would like some help to implement the .ts formats to play via http:// i have looked a few examples but i cant figure it out can you point me to the right direction please thank you
is it possible to play .mxg format in exoplayer ?
Hello Ayalus,
Nice work. Can you update this code, to work with Playlist like just take 3 items in a Recyclerview (static only) and start playing first one, once first one is complete auto start second one and we can also tap on prev / next buttons to play the same one. Just like a small portion of YouTube
As I have seen your expertise with ExoPlayer, I believe you already implemented same kind of thing in past, so can you please share with us.
Period release failed.
java.lang.NullPointerException: Attempt to get length of null array
at com.google.android.exoplayer2.source.hls.HlsMediaPeriod.release(HlsMediaPeriod.java:109)
at com.google.android.exoplayer2.source.hls.HlsMediaSource.releasePeriod(HlsMediaSource.java:85)
at com.google.android.exoplayer2.source.LoopingMediaSource.releasePeriod(LoopingMediaSource.java:86)
at com.google.android.exoplayer2.ExoPlayerImplInternal$MediaPeriodHolder.release(ExoPlayerImplInternal.java:1283)
at com.google.android.exoplayer2.ExoPlayerImplInternal.releasePeriodHoldersFrom(ExoPlayerImplInternal.java:1091)
at com.google.android.exoplayer2.ExoPlayerImplInternal.resetInternal(ExoPlayerImplInternal.java:629)
at com.google.android.exoplayer2.ExoPlayerImplInternal.stopInternal(ExoPlayerImplInternal.java:600)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:311)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.google.android.exoplayer2.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40)
The following demo doesn't work for latest exoplayer version 2.2.0
.
Please update the demo.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.