Skip to content

Commit

Permalink
Embed object boolean properties should be non-nullable and always exp…
Browse files Browse the repository at this point in the history
…osed when serialized to JSON
  • Loading branch information
abjerner committed Sep 11, 2024
1 parent 5fa79d8 commit c70f420
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/Limbo.Umbraco.YouTube/Models/Videos/YouTubeEmbed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,44 +24,44 @@ public class YouTubeEmbed : IVideoEmbed {
/// <summary>
/// Gets whether embedded videos should automatically start playing.
/// </summary>
[JsonProperty("autoplay", NullValueHandling = NullValueHandling.Ignore)]
public bool? Autoplay { get; }
[JsonProperty("autoplay")]
public bool Autoplay { get; }

/// <summary>
/// Gets whether embedded videos should loop.
/// </summary>
[JsonProperty("loop", NullValueHandling = NullValueHandling.Ignore)]
[JsonProperty("loop")]
public bool? Loop { get; }

/// <summary>
/// Gets whether the player controls should be visible.
/// </summary>
[JsonProperty("controls", NullValueHandling = NullValueHandling.Ignore)]
public bool? ShowControls { get; }
[JsonProperty("controls")]
public bool ShowControls { get; }

/// <summary>
/// Gets whether the player should show related videos once the video has finished playing.
/// </summary>
[JsonProperty("rel", NullValueHandling = NullValueHandling.Ignore)]
public bool? ShowRelated { get; }
[JsonProperty("rel")]
public bool ShowRelated { get; }

/// <summary>
/// Gets whether the embed code should use a cookieless player. Notice that this doesn't entirely disable cookies,
/// but the player won't set any cookies until the user starts the video.
/// </summary>
[JsonProperty("cookieless", NullValueHandling = NullValueHandling.Ignore)]
public bool? DisableCookies { get; }
[JsonProperty("cookieless")]
public bool DisableCookies { get; }

/// <summary>
/// Gets the the time of the video that the player should start playing at, if any.
/// </summary>
[JsonProperty("start", NullValueHandling = NullValueHandling.Ignore)]
[JsonProperty("start")]
public string? Start { get; }

/// <summary>
/// Gets the the time of the video that the player should stop at, if any.
/// </summary>
[JsonProperty("end", NullValueHandling = NullValueHandling.Ignore)]
[JsonProperty("end")]
public string? End { get; }

/// <summary>
Expand All @@ -85,11 +85,11 @@ internal YouTubeEmbed(YouTubeVideoDetails video, YouTubeVideoParameters paramete

Config = config;

Autoplay = config?.Autoplay ?? parameters.Autoplay;
Loop = config?.Loop ?? parameters.Loop;
ShowControls = config?.ShowControls ?? parameters.ShowControls;
ShowRelated = config?.ShowRelated ?? parameters.ShowRelated;
DisableCookies = config?.DisableCookies ?? parameters.DisableCookies;
Autoplay = config?.Autoplay ?? parameters.Autoplay ?? false;
Loop = config?.Loop ?? parameters.Loop ?? false;
ShowControls = config?.ShowControls ?? parameters.ShowControls ?? true;
ShowRelated = config?.ShowRelated ?? parameters.ShowRelated ?? true;
DisableCookies = config?.DisableCookies ?? parameters.DisableCookies ?? false;
Start = parameters.Start?.TotalSeconds.ToString(CultureInfo.InvariantCulture);
End = parameters.End?.TotalSeconds.ToString(CultureInfo.InvariantCulture);

Expand Down

0 comments on commit c70f420

Please sign in to comment.