Hello,
I have some videos that play well on localhost but don't work on the server, ex;
https://youtu.be/Nnqk-yGzYYg
https://youtu.be/4uE-tqe0xsQ
Please advise.
Possible Causes:
Possible Causes:
- Server is in a different country = videos might be blocked in that country.
- Server provider is blocking calls to youtube.
Thanks for this, but both items don't apply!
- Do they fail each time?
- Server OS?
- .net core/.net framework/mono version
- What error is returned?
Please note: the videos are working fine on the local machine!
Could you give the above videos a try?
@SlowLogicBoy Any ideas? Is possible to try the videos at your end?
The IP which requested the stream info set and the IP which later accesses a stream should match.
Stream URLs are valid for specific IP.
@Tyrrrz it doesn't work for me when I create the video and trying to watch it from the same IP, so I think your assumption couldn't be the reason.
Why does it work on localhost?
BTW: this happens with some videos and other videos work fine, could you try to the videos yourself?
I hope to get this solved ASAP. Thanks in advance.
Your help is appreciated.
I can download those videos locally.
it doesn't work for me when I create the video and trying to watch it from the same IP
If i understood correctly the stream URLs are resolved server-side, which means they are valid to be requested by the server itself, not the originator of a web request.
Can you give an example URL that fails?
Thanks @Tyrrrz!
I made a test website and here are 2 links:
http://wesbyte-001-site3.etempurl.com/w/acoq
http://wesbyte-001-site3.etempurl.com/w/Mboq
Please note, the same script loads other videos successfully and the videos that are not working now were working before without issues.
Please advise ASAP.
@Tyrrrz @SlowLogicBoy any ideas?
The videos don't play for me, it returns 403 for my IP.
As you can see from this URL, it's generated for 205.144.171.127 which is your server IP.
Thanks for inspecting this, I have added another video at http://wesbyte-001-site3.etempurl.com/w/zmo the generated URL as seen below is for the same server IP and the video works fine, so do you think that the IP is not the issue? I need to know the exact reason and how to handle it, please help me ... Thanks in advance.
https://r3---sn-apo3qvuoxuxbt-j5pz.googlevideo.com/videoplayback?expire=1561137034&ei=KrsMXe29LKyTkASM6JaACQ&ip=205.144.171.127&id=o-AAZTPT72cFxY3tl727sFR3bGL9KgTvrUacrXOIl1Qvw4&itag=18&source=youtube&requiressl=yes&mime=video%2Fmp4&gir=yes&clen=6198133&ratebypass=yes&dur=214.505&lmt=1540820048896432&fvip=3&c=WEB&txp=5531432&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cmime%2Cgir%2Cclen%2Cratebypass%2Cdur%2Clmt&sig=ALgxI2wwRAIgNYaR_F1KbGaysNdUrOosShYvmXsVx3FXKJCJ7Tqd8D8CIB8Zc90DGDPXt2zMEomVfm6UPrWNDuOwfKUy0H9mWzyF&redirect_counter=1&rm=sn-a5mds7s&req_id=d1c37da9e82a36e2&cms_redirect=yes&ipbypass=yes&mip=45.243.182.195&mm=31&mn=sn-apo3qvuoxuxbt-j5pz&ms=au&mt=1561115290&mv=m&pl=22&lsparams=ipbypass,mip,mm,mn,ms,mv,pl&lsig=AHylml4wRQIgeFlWN5c5Zd1PAOscPKNHZYsh6WrkW0zMlWWXS1V0eOsCIQCpZf_4ZZ4wsrDK7XTOdntJ5Sduob7-E0uAWwP6iTiMFA==
Yes, as you've mentioned, the IP is the same but it's not my IP and not your IP
But the first video doesn't work but the second one works while the server IP is the same in both cases, so why do you think the IP is the issue? and is there a workaround for this?
Hm, in my case both of them didn't work
Apart from that, I honestly don't know.
A workaround is to either get video stream info set on frontend (e.g. via Blazor) or return a video stream as a stream instead of a URL from the backend.
Please try this URL http://wesbyte-001-site3.etempurl.com/w/zmo and look into the HTML source code to get the URL (it works), it will work and you may be able to compare it to http://wesbyte-001-site3.etempurl.com/w/acoq (it doesn't work)
BTW: The streaming URL seems to expire after a while that's why you didn't get it to work.
FYI: my requirements is to display the video and not to download it.
Yes, that works. I really don't know what to advise regarding the reasons for why the second one fails besides the IP difference, maybe it's not enforced on all videos.
Consider making a controller action that returns a Stream and use GetMediaStreamAsync to route the data to the client.
I'm using GetVideoMediaStreamInfosAsync is that the same as GetMediaStreamAsync ?
No, those are different.
GetVideoMediaStreamInfosAsync requests a list of streams and their metadata.
GetMediaStreamAsync resolves an actual stream from metadata
Apart from that, I honestly don't know.
A workaround is to either get video stream info set on frontend (e.g. via Blazor) or return a video stream as a stream instead of a URL from the backend.
I'll give GetMediaStreamAsync a try and let you know the result, re. your above comment, do you have a code sample to get the stream instead of the URL?
I appreciate your help on this :)
You can probably take some inspiration from https://github.com/SlowLogicBoy/YoutubeExplode.AspNetCore.Mvc
You can probably take some inspiration from https://github.com/SlowLogicBoy/YoutubeExplode.AspNetCore.Mvc
Thanks, @Tyrrrzi ! I think this is to download the video and not to display it in the bowser ... Am I correct?
@Tyrrrz and @SlowLogicBoy I got the below error which could help:
YoutubeExplode.Exceptions.UnrecognizedStructureException: Could not find signature decipherer function name. at YoutubeExplode.YoutubeClient.d__40.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at YoutubeExplode.YoutubeClient.d__43.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at VB.VB$StateMachine_1_GetVideoStream.MoveNext()
Update to latest version
The update did the trick. Thanks a million :)))))
You're welcome :)
Most helpful comment
Update to latest version