webtor-io/embed-sdk-js

Not able to switch torrent that is being played

edwinork opened this issue · 4 comments

I am trying to implement a feature where a user can select a torrent from a list and it starts playing in your Webtor embed. When I select a torrent the first time, it starts playing just fine. However, when I select a second torrent, while the first selection is playing, your player does not react.

I did some debugging and found that on second selection everything works as expected until this check in your script:
else if (d.name == self.INJECT && !injected)
From what I understand, the only way to set injected back to false is to reload the whole script by reloading the page, which is not a desired workaround for me.

I found that this is caused by an intentional change that you made in this commit: fix multiple players per window. It makes sense because when I manually set injected to false during debug, then another Webtor embed is created underneath the first one which causes 2 torrents to play at the same time. However, wouldn't it solve the problem if I remove the container element, then recreate it before "pushing" the second torrent? Are there bad side effects to this approach?

I also looked around for other apps that use your SDK and have a similar use case to mine. I found PopcornTime Show. It seems that dynamic switching also does not work in this app and the only way to play another torrent is to reload the page. So maybe @ChrisMichaelPerezSantiago would also be interested in this.

Thank you for the great service that you are providing. Webtor is definitely one of a kind.

Hi @edwinork!
May I ask you to share your example somewhere to check it?

Definitely! I made a small demo of the issue.

Thank you for looking into it.

Thanks for demo @edwinork
You can check, now it is working as expected.

Works great! Thank you!