exoPlayer not playing a radiostream on specific android device(s) as a service -


so have 3 real devices : (a) samsung galaxy s3, (b) nexus 1 (c) samsung galaxy note 3

i tried play radio stream in activity using below code of devices , worked :

private static final int buffer_segment_size = 64 * 1024; private static final int buffer_segment_count = 256; private static final int renderer_count = 1;  exoplayer exoplayer = exoplayer.factory.newinstance(renderer_count);                 exoplayer.addlistener(this);                 uri radiouri = uri.parse(streaminglink);                 allocator allocator = new defaultallocator(buffer_segment_size);                 string useragent = util.getuseragent(this, "randomthing");                 datasource datasource = new defaulturidatasource(this, null, useragent);                 extractorsamplesource samplesource = new extractorsamplesource(radiouri, datasource, allocator, buffer_segment_size * buffer_segment_count);                 mediacodecaudiotrackrenderer audiorenderer = new mediacodecaudiotrackrenderer(samplesource);                 exoplayer.prepare(audiorenderer);                 exoplayer.setplaywhenready(true); 

now tried same code in service :

myservice extends service implements exoplayer.listener { ...  @override     public void onplayerstatechanged(boolean playwhenready, int playbackstate) {     } ... } 

for devices , b, still worked playbackstate value being exoplayer.state_ready , radio playing.

nevertheless device c, after service's code above execution, playbackstate value shows exoplayer.state_idle right away , no radio...

what getting wrong here?

nb : 'this' represents respectively in both cases activity , service. also, streaminglink same 1 in cases.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -