Merge pull request #95 from lishoujun/develop
add log to debug #86 fatal
This commit is contained in:
commit
991a758605
@ -184,8 +184,9 @@ public class VideoPlayActivity extends AppCompatActivity implements VideoRendere
|
|||||||
torrentStream.addListener(new TorrentListener() {
|
torrentStream.addListener(new TorrentListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onStreamReady(Torrent torrent) {
|
public void onStreamReady(Torrent torrent) {
|
||||||
Log.d(TAG, "Ready");
|
String videopath = Uri.fromFile(torrent.getVideoFile()).toString();
|
||||||
mService.setCurrentStreamUrl(Uri.fromFile(torrent.getVideoFile()).toString());
|
Log.d(TAG, "Ready! torrentStream videopath:" + videopath);
|
||||||
|
mService.setCurrentStreamUrl(videopath);
|
||||||
startPlayer();
|
startPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ import androidx.annotation.Nullable;
|
|||||||
import android.support.v4.media.MediaDescriptionCompat;
|
import android.support.v4.media.MediaDescriptionCompat;
|
||||||
import android.support.v4.media.session.MediaSessionCompat;
|
import android.support.v4.media.session.MediaSessionCompat;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.google.android.exoplayer2.C;
|
import com.google.android.exoplayer2.C;
|
||||||
import com.google.android.exoplayer2.ExoPlayerFactory;
|
import com.google.android.exoplayer2.ExoPlayerFactory;
|
||||||
@ -82,6 +83,8 @@ public class VideoPlayerService extends Service {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
|
Log.v(TAG, "onCreate...");
|
||||||
|
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
|
||||||
player = ExoPlayerFactory.newSimpleInstance(getApplicationContext(), new DefaultTrackSelector());
|
player = ExoPlayerFactory.newSimpleInstance(getApplicationContext(), new DefaultTrackSelector());
|
||||||
@ -136,7 +139,11 @@ public class VideoPlayerService extends Service {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
|
Context context = this;
|
||||||
Log.v(TAG, "onStartCommand...");
|
Log.v(TAG, "onStartCommand...");
|
||||||
|
if(currentStreamUrl == null){
|
||||||
|
Toast.makeText(context, "currentStreamUrl must not null", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
playVideo();
|
playVideo();
|
||||||
return START_STICKY;
|
return START_STICKY;
|
||||||
}
|
}
|
||||||
@ -150,7 +157,7 @@ public class VideoPlayerService extends Service {
|
|||||||
|
|
||||||
public void setCurrentStreamUrl(String streamUrl)
|
public void setCurrentStreamUrl(String streamUrl)
|
||||||
{
|
{
|
||||||
Log.v(TAG, "setCurrentStreamUrl...");
|
Log.v(TAG, "setCurrentStreamUrl..." + streamUrl);
|
||||||
currentStreamUrl = streamUrl;
|
currentStreamUrl = streamUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user