Open ababutski opened 4 years ago
Hi @ababutski, I can't reproduce this on my end - are you sure that's the state of the layout object when you're calling StartArchive
? Can you share a sample with me reproducing the error?
Hi @ababutski - this does point out some missing test cases in the PR I just merged so I opened a new one with them. Your case is: https://github.com/opentok/Opentok-.NET-SDK/pull/149/files#diff-2e1774c18226f056e66f367a2d4587f1R718 - and it is passing. Let me know if you have anything that can help me track down what the issue is.
Thanks,
Hi @slorello89. I looked at tests. They are run with mocked HttpClient, so requests are not sent to real server. And this is a key difference. I tested this case with two examples: First one: var layoutType = new ArchiveLayout { Type = LayoutType.verticalPresentation, StyleSheet = "" }; var archive = openTok.StartArchive(sessionId, string.Empty, true, true, type, "1280x720", layoutType);
In this case, HttpRequest body, that is sent to TokBox server, will look like this:
{"sessionId":"some session id","name":"","hasVideo":true,"hasAudio":true,"outputMode":"composed","resolution":"1280x720","layout":{"type":"verticalPresentation", "stylesheet":"" }}
Second example:
var layoutType = new ArchiveLayout { Type = LayoutType.verticalPresentation, StyleSheet = null }; var archive = openTok.StartArchive(sessionId, string.Empty, true, true, type, "1280x720", layoutType); In this situation HttpRequest body will be: {"sessionId":"some session id","name":"","hasVideo":true,"hasAudio":true,"outputMode":"composed","resolution":"1280x720","layout":{"type":"verticalPresentation"}} As you can see, in second example, there is no StyleSheet param in JSON. When it is presented in request but empty real server return 400 BadRequest response with message "Only custom type may have stylesheet"
Hope this helps
Thanks @ababutski - this has been very helpful - I see exactly what you mean - have updated the PR To manage this :) Ironically I did have a test case to test this scenario - but of course it was only testing with a null string.
OpenTok.StartArchive() method call with var layout = new ArchiveLayout { Type = LayoutType.verticalPresentation, StyleSheet = "" }; throws an exception "Only custom type may have stylesheet". But it looks like this case has to be covered in here https://github.com/opentok/Opentok-.NET-SDK/blob/06211aa913711f591c3564985d4caa572dae79c3/OpenTok/OpenTok.cs#L286