IDimitrovDev / Energy-Media-Player

Energy Media Player is XBOX and Windows 10 media player
8 stars 0 forks source link

Playing streaming videos #5

Open armpogart opened 5 months ago

armpogart commented 5 months ago

Any way to play streams by URL when we don't have the file locally? Or maybe you will consider that as a feature request?

IDimitrovDev commented 5 months ago

There is a Open network stream option from the context menu where URL can be entered(on right click or using the dedicated settings button). image image

armpogart commented 5 months ago

This doesn't work with local streamed URL. My URL looks like http://localhost:8090/stream/FILENAME.mkv?link=500a63fe0609e96f8c818dbc7dfdbe5d238b274a&index=1&play. That's a URL from TorrServer which works in VNC.

armpogart commented 5 months ago

Also I've tried to open sequentially downloaded torrent file and player fails to open it either (I guess the file is partially downloaded). That also works in VNC, but Energy Media Player opens it only after fully downloading. Is there a chance partial files and streaming torrents can be supported?

IDimitrovDev commented 5 months ago

For packaged windows store apps Microsoft has forbidden access to the localhost of the machine for security reasons and this is why localhost is not accessible and if user wants to be able to access it has to manually enable it, because there are no exposed capabilities to be enabled from the packaged app.(more). This can be done running the following commands in powershell as administrator

checknetisolation loopbackexempt -a -n="6615IvanDimitrov89.EnergyPlayer"

To disable it when no more needed

checknetisolation loopbackexempt -d -n="6615IvanDimitrov89.EnergyPlayer"

and to start the network isolation session:

checknetisolation loopbackexempt -is

stackoverflow

For partial torrents playback one needs to enable both "Download in sequential order" and "Download first and last pieces first". This is needed because most video formats are keeping metadata at the end of the file so to play sequentially the player needs first and last blocks and from there it should be able to play it(seeking may not work if seek range is not loaded).

armpogart commented 5 months ago

@IDimitrovDev Thanks for your quick response. Unfortunately, my torrent client doesn't have an option to Download first and last pieces first, it only has Download in sequential order. But VLC is still able to play that specific file only with Download in sequential order, so maybe you can reconsider playing those video files which are possible to play without last peice.

Thanks for the info on network isolation of loopback for MsStore Apps, I wasn't aware of that, and yes, it helped the player to play the streaming file from TorrServer, so I guess it properly downloads also last piece.. P.S. only enabling loopback for the app didn't help, I needed to explicitly start network isolation session as you've stated,

IDimitrovDev commented 5 months ago

I will try some more files with download in sequential order to see if there are issues with files that are supposed to be played but fail to. The torrent client that I tried with Download first and last pieces first was qBitorrrent in case you want to give it a try. TorrServer actually downloads only the requested blocks from the files which also makes the seeking to any duration in the file available.

armpogart commented 5 months ago

Thanks, I'll try qBitorrent. I use PicoTorrent which is very minimal and quite performant for what I need. So TorrServer also doesn't download the last piece? Then I'm not sure, why the stream from TorrServer works, but download in sequential order from PicoTorrent doesn't work. For the seeking, I use TorrServer usually for watching some movies, that I won't need to keep in PC, and in that scenario I don't need any seeking, I'm just firing TorrServer with high RAM buffer set and immediately start to watch the movie, and now use your player primarily, as I got Dolby Vision ready laptop and it's only player that is perfectly handling all of HDR and DV content.

Thanks for your great work!

IDimitrovDev commented 5 months ago

I meant that TorrServer plays the requested blocks so depending on the file will load last block if needed(like when player requests metadata) or not. And with seeking it doesn't needed to sequentially load to the seeked block but can start from it. image. This is an example of file started and seeked in the middle and we can see that last block was loaded because of metadata, and we have some blocks in the beginning loaded for the initial play and then we have the ones in the middle where we seeked