Please see the thread on stack overflow. I really want to move on!
var sourceUrl = Sources.First().SourceUrl;
What happens if either Sources or .First() are null? You can't try to get .SourceUrl from a null object.
You need to assume anything and everything fails. Check if Sources is null... Check if .First() is null... Then only process if neither is null.
Then again same problem with VideoPlayer.Play(sourceUrl) - you don't check to see if sourceUrl has a value before passing it into the the VideoPlayer.
All your code is great - if you are in a perfect world and nothing ever fails or returns null. Writing code is generally easy. Error handling and making robust code takes a lot more effort.
I had done it this way before too, without success. But for the purpose of showing you, I did it exactly with your code. Look at what happens 1. I can click the episodes opening the video puu.sh/t1XcQ/302e2a11f7.png 2. I can watch the video without any problems, its perfect! puu.sh/t1Xft/0d35f62409.png 3. After clicking done in the left top corner, after about 3~ seconds this error pops up puu.sh/t1Xh6/e2362bccbd.png
I do agree with you that making the code robust is a must. However it's more in a concept fase than a good working version. If I wouldnt have gotten the error I'm having trouble with right now, I wouldve added these null check's. But Im really sure that's not the problem. I will make a demo project to see if I can reproduce the error.
I fixed it. It was not relevant to the code that plays the video as suggested by you. Thanks alot!
Xamarin Inc., as a wholly-owned Microsoft subsidiary acting as a separate legal entity, adheres to the Microsoft Privacy Statement: Privacy & cookies