se-bastiaan / TorrentStream-Android

A torrent streamer library for Android based on libtorrent4j
Other
343 stars 108 forks source link

Cannot start download #32

Closed richjhart closed 7 years ago

richjhart commented 7 years ago

I am trying to load a local torrent, and it's able to load it and create the file, and triggers onStreamPrepared(), but never actually starts downloading.

I get the following errors: D/dalvikvm: Trying to load lib /data/app-lib/net.volumetouch.android.uhdpro-2/libjlibtorrent.so 0x417a49f0 D/dalvikvm: Added shared lib /data/app-lib/net.volumetouch.android.uhdpro-2/libjlibtorrent.so 0x417a49f0 D/dalvikvm: No JNI_OnLoad found in /data/app-lib/net.volumetouch.android.uhdpro-2/libjlibtorrent.so 0x417a49f0, skipping init

I have checked and the file exists.

se-bastiaan commented 7 years ago

Those are not errors. Try to provide as much information as you can, otherwise I can't help you.

richjhart commented 7 years ago

I'm just trying to start a simple torrent:

        File destination = FileUtil.downloadFolder;
        TorrentOptions options = new TorrentOptions.Builder()
                .saveLocation(destination)
                .removeFilesAfterStop(false)
                .build();
        TorrentStream stream = TorrentStream.init(options);
        stream.addListener(this);
        stream.startStream("file:///mnt/internal_sd/Movies/UHDDevice/test.torrent");

And I just have a debug statement in each of the listener events, such as:

    @Override
    public void onStreamPrepared(Torrent torrent) {
        L.d(L.DEBUG_TORRENT, "stream prepared");
    }

and

    @Override
    public void onStreamStarted(Torrent torrent) {
        L.d(L.DEBUG_TORRENT, "stream started");
    }

The torrent is just one I found online - it works elsewhere, and within the app it creates an empty file at the expected location, but it stays at 0 bytes and I never hit any of the events other than onStreamPrepared().

I have an internet connection, and it did actually start downloading in another torrent library (but that had other issues, and doesn't appear to be being maintained).

I'm running Android 4.4.2.

se-bastiaan commented 7 years ago

You're not getting any further because the download is not started 😁 Try calling torrent.startDownload(); in onStreamPrepared. Like in the sample.

richjhart commented 7 years ago

Ah - in that case I would suggest the readme needs updating. It says you only need to call startStream(), and that a listener is optional.

se-bastiaan commented 7 years ago

Mmm, you have a valid point. It might be better to change the behaviour though and add a configuration option.