Comments (21)
ExoPlayer doesn't follow cross-protocol redirects by default.
Enable cross-protocol redirects:
DefaultHttpDataSourceFactory httpDataSourceFactory =
new DefaultHttpDataSourceFactory(
Util.getUserAgent(context, context.getPackageName()),
null,
DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS,
true/*allowCrossProtocolRedirects*/);
DefaultDataSourceFactory dataSourceFactory = new DefaultDataSourceFactory(
context, httpDataSourceFactory);
Play m3u8
media:
- add dependency:
exoplayer-dls
implementation 'com.google.android.exoplayer:exoplayer-hls:2.11.7'
- create a
HlsMediaSource.Factory
instance:
public class MyFactory extends PlayerService.ComponentFactory {
HlsMediaSource.Factory mHlsMediaSourceFactory;
@Override
public void init(Context context) {
...
mHlsMediaSourceFactory = new HlsMediaSource.Factory(dataSourceFactory);
}
...
}
- use
HlsMediaSource.Factory
instance create aExoMusicPlayer
:
@Inject
@NonNull
@Override
public MusicPlayer createMusicPlayer(Context context) {
return new ExoMusicPlayer(context, mHlsMediaSourceFactory);
}
from snow.
ok you can add it in your SNAPSHOT? we are waiting for further testing
from snow.
This repository has added support for jitpack
, you can built it yourself: https://jitpack.io/#jrfeng/snow
from snow.
i Dont know why ..
implementation 'com.github.jrfeng.snow:player:master-651f631386-1'
`Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve
com.github.jrfeng.snow:player:master-651f631386-1.`
from snow.
from snow.
Have you tried this: https://github.com/jitpack/jitpack.io/issues/3758#issuecomment-630306373
from snow.
Yes its not work
maven { url 'https://www.jitpack.io' }
and
implementation 'com.github.jrfeng.snow:player:master-651f631386-1'
error:
`Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve
com.github.jrfeng.snow:player:master-651f631386-1.`
Pls check
"make the library readable to everyone."
from snow.
OK, I'll publish a new release, you can try it again.
from snow.
using implementation 'com.github.jrfeng.snow:player:1.0-alpha5'
after invalided /cache /restarted
Same issue Old Api version 18
ur: https://vidhttps.r.worldssl.net/thanthi-origin/liveabr/playlist.m3u8
`09-01 11:23:28.494 2306-2306/com.example.snowtest E/TAG: onConnected: true
09-01 11:23:42.025 2306-2318/com.example.snowtest E/MediaPlayer: error (1, -1004)
09-01 11:23:42.025 2306-2306/com.example.snowtest E/MediaPlayer: Error (1,-1004)
09-01 11:23:42.025 2306-2306/com.example.snowtest E/MediaMusicPlayer: MediaPlayer Error[what: 1, extra: -1004]
09-01 11:23:42.025 2306-2306/com.example.snowtest E/MusicPlayer: errorCode:5`
Same url working fine with api 29 emulator
Same issue Old Api version 20
url : http://playerservices.streamtheworld.com/api/livestream-redirect/HARRISJAYARAJ_S01.aac
Not no sound nio error (Not work)
Working fine Api version 18 emulator
Also no notification icon api level 18..
notification icon showing working fine api level29
from snow.
@webwayscript OK, I'll check it out.
from snow.
This doesn't seem to be a bug in this project.
Maybe you can check this StackOverflow post: https://stackoverflow.com/a/51285550/4768512
from snow.
yes .. this is the problem.. I think we need fix inside our app or your project library?
ok i will check it inside my app
from snow.
No its not work .. also not work all m3u8 in old apimlevel 18
another url : http://airlsmp6-lh.akamaihd.net/i/AIRLSMP134_1@369210/master.m3u8
also i try with
oncreat ;
`try {
ProviderInstaller.installIfNeeded(getApplicationContext());
SSLContext sslContext;
sslContext = SSLContext.getInstance("TLSv1.2");
sslContext.init(null, null, null);
sslContext.createSSLEngine();
} catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException
| NoSuchAlgorithmException | KeyManagementException e) {
e.printStackTrace();
}`
implementation 'com.google.android.gms:play-services-auth:18.1.0'
not work m3u8 in old api level
from snow.
I received following error when i use your GitHub project
Ex url": http://airlsmp6-lh.akamaihd.net/i/AIRLSMP134_1@369210/master.m3u8
`snow.player.debug E/ExoMusicPlayer: com.google.android.exoplayer2.ExoPlaybackException:
com.google.android.exoplayer2.source.UnrecognizedInputFormatException: None of the available extractors
(MatroskaExtractor, FragmentedMp4Extractor, Mp4Extractor, Mp3Extractor, AdtsExtractor, Ac3Extractor, TsExtractor,
FlvExtractor, OggExtractor, PsExtractor, WavExtractor, AmrExtractor, Ac4Extractor, FlacExtractor) could read the stream.`
from snow.
Maybe you should check your audio source. This is not a bug in this project, I can't help for this, sorry.
from snow.
https://github.com/jrfeng/snow/blob/master/exo/src/main/java/snow/player/exo/ExoMusicPlayer.java
there is no HlsMediaSourceFactory ...
from snow.
http://airlsmp6-lh.akamaihd.net/i/AIRLSMP134_1@369210/master.m3u8
this source very popular and no 1 audio video source from akamaihd.net...
from snow.
https://github.com/jrfeng/snow/blob/master/exo/src/main/java/snow/player/exo/ExoMusicPlayer.java
there is no HlsMediaSourceFactory ...
Maybe you should learn how to use ExoPlayer
? Don't mind, I'll create a helper to simplify this operation.
from snow.
i use like this all urls working fine.
`private OkHttpDataSourceFactory dataSourceFactory;
private SimpleExoPlayer exoPlayer;
onCreate
OkHttpClient okHttpClient;
okHttpClient = new OkHttpClient.Builder()
.connectTimeout(10, TimeUnit.SECONDS)
.writeTimeout(10, TimeUnit.SECONDS)
.readTimeout(10, TimeUnit.SECONDS)
.build();
exoPlayer = new SimpleExoPlayer.Builder(context).build();
dataSourceFactory = new OkHttpDataSourceFactory(okHttpClient, Util.getUserAgent(context, useragent));
private void prepareToPlay(Uri uri) {
if( String.valueOf(uri).contains("m3u8") ) {
MediaSource videoSource = new HlsMediaSource.Factory(dataSourceFactory).createMediaSource(uri);
exoPlayer.prepare(videoSource);
}else{
MediaSource videoSource = new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(uri);
exoPlayer.prepare(videoSource);
}
}`
This code all m3u8 with or with https working fine .. and also all redirected working fine.. its working fine from api level 16 up to latest version.. I dont know why its not working with your library
Just now i found you using more code in MyFactory.java.. May be okhttp fix all https problem ..
from snow.
@webwayscript Thanks for feedback, I'll check it carefully.
from snow.
@webwayscript Can you provide some url of m3u8
media? If it's private, you can send it to my email: [email protected]
from snow.
Related Issues (20)
- Android Latest Version Notification Problem HOT 4
- getPlayProgress 使用问题 HOT 2
- Fatal Exception: android.app.ForegroundServiceStartNotAllowedException HOT 6
- Custom Notification icon HOT 6
- Fatal Exception: java.lang.IndexOutOfBoundsException HOT 2
- EqualizerActivity Failed resolution of: Landroidx/databinding/DataBinderMapperImpl; HOT 7
- STATE_BUFFERING update when play start HOT 1
- 忽略音频焦点会闪退,闪退后无法播放音频,需要重新启用音频焦点才行 HOT 6
- EqualizerActivity 正在播放音频开启均衡器会闪退 HOT 3
- 为什么有些网络歌曲没播放完就直接播放下一首了
- How can I add images of songs in local music and album ? HOT 5
- moveMusicItem 移动歌曲位置有问题啊。 HOT 3
- “"音量均衡”功能和修改”随机播放“算法 HOT 10
- AppWidget 怎么接收不到广播啊? HOT 12
- MIUI14上通知栏专辑封面显示问题 HOT 6
- setNextPlay()添加下一首播放有问题。 HOT 3
- qq音乐的播放链接不能播放,用浏览器直接打开是没问题的 HOT 1
- Android 13 黑屏音乐过一会就会停止播放 HOT 15
- 寻求一下帮助。 HOT 9
- 没有设置播放音量大小的方法吗 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from snow.