Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenTok.StartArchive with layout != LayoutType.Custom and StyleSheet == "" #148

Open
ababutski opened this issue Aug 18, 2020 · 4 comments

Comments

@ababutski
Copy link

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

if (layout?.Type == LayoutType.custom && string.IsNullOrEmpty(layout?.StyleSheet) ||

@slorello89
Copy link
Contributor

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?

@slorello89
Copy link
Contributor

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,

@ababutski
Copy link
Author

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

@slorello89
Copy link
Contributor

slorello89 commented Aug 19, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants