Giter VIP home page Giter VIP logo

Comments (21)

jrfeng avatar jrfeng commented on June 13, 2024

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:

  1. add dependency: exoplayer-dls
implementation 'com.google.android.exoplayer:exoplayer-hls:2.11.7'
  1. 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);
    }
    ...
}
  1. use HlsMediaSource.Factory instance create a ExoMusicPlayer:
@Inject
@NonNull
@Override
public MusicPlayer createMusicPlayer(Context context) {
    return new ExoMusicPlayer(context, mHlsMediaSourceFactory);
}

from snow.

webwayscript avatar webwayscript commented on June 13, 2024

ok you can add it in your SNAPSHOT? we are waiting for further testing

from snow.

jrfeng avatar jrfeng commented on June 13, 2024

This repository has added support for jitpack, you can built it yourself: https://jitpack.io/#jrfeng/snow

from snow.

webwayscript avatar webwayscript commented on June 13, 2024

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.

webwayscript avatar webwayscript commented on June 13, 2024

jitpack/jitpack.io#3758

from snow.

jrfeng avatar jrfeng commented on June 13, 2024

Have you tried this: https://github.com/jitpack/jitpack.io/issues/3758#issuecomment-630306373

from snow.

webwayscript avatar webwayscript commented on June 13, 2024

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.

jrfeng avatar jrfeng commented on June 13, 2024

OK, I'll publish a new release, you can try it again.

from snow.

webwayscript avatar webwayscript commented on June 13, 2024

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.

jrfeng avatar jrfeng commented on June 13, 2024

@webwayscript OK, I'll check it out.

from snow.

jrfeng avatar jrfeng commented on June 13, 2024

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.

webwayscript avatar webwayscript commented on June 13, 2024

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.

webwayscript avatar webwayscript commented on June 13, 2024

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.

webwayscript avatar webwayscript commented on June 13, 2024

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.

jrfeng avatar jrfeng commented on June 13, 2024

Maybe you should check your audio source. This is not a bug in this project, I can't help for this, sorry.

from snow.

webwayscript avatar webwayscript commented on June 13, 2024

https://github.com/jrfeng/snow/blob/master/exo/src/main/java/snow/player/exo/ExoMusicPlayer.java
there is no HlsMediaSourceFactory ...

from snow.

webwayscript avatar webwayscript commented on June 13, 2024

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.

jrfeng avatar jrfeng commented on June 13, 2024

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.

webwayscript avatar webwayscript commented on June 13, 2024

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.

jrfeng avatar jrfeng commented on June 13, 2024

@webwayscript Thanks for feedback, I'll check it carefully.

from snow.

jrfeng avatar jrfeng commented on June 13, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.