Skip to content

Conversation

@KellsoHP
Copy link
Contributor

If u set video source from attribute and then onerror rised:

fail: BlazoredVideo[0]
      Failed to convert the JSON: {"name":"error","state":{"controls":true,"currentSrc":"https://localhost:5000/asdfa","defaultPlaybackRate":1,"error":{},"networkState":3,"paused":true,"playbackRate":1,"preload":"metadata","src":"https://localhost:5000/asdfa","volume":1}}
System.Text.Json.JsonException: The JSON value could not be converted to Blazored.Video.Support.MediaError. Path: $.state.error | LineNumber: 0 | BytePositionInLine: 118.
   at System.Text.Json.ThrowHelper.ThrowJsonException(String message)
   at System.Text.Json.Serialization.Converters.EnumConverter`1[[Blazored.Video.Support.MediaError, Blazored.Video, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1[[Blazored.Video.Support.MediaError, Blazored.Video, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1[[Blazored.Video.Support.VideoState, Blazored.Video, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, VideoState& value)
   at System.Text.Json.Serialization.JsonConverter`1[[Blazored.Video.Support.VideoState, Blazored.Video, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, VideoState& value)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1[[Blazored.Video.Support.VideoState, Blazored.Video, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1[[Blazored.Video.Support.VideoEventData, Blazored.Video, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, VideoEventData& value)
   at System.Text.Json.Serialization.JsonConverter`1[[Blazored.Video.Support.VideoEventData, Blazored.Video, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, VideoEventData& value)
   at System.Text.Json.Serialization.JsonConverter`1[[Blazored.Video.Support.VideoEventData, Blazored.Video, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadFromSpan[VideoEventData](ReadOnlySpan`1 utf8Json, JsonTypeInfo jsonTypeInfo, Nullable`1 actualByteCount)
   at System.Text.Json.JsonSerializer.ReadFromSpan[VideoEventData](ReadOnlySpan`1 json, JsonTypeInfo jsonTypeInfo)
   at System.Text.Json.JsonSerializer.Deserialize[VideoEventData](String json, JsonSerializerOptions options)
   at Blazored.Video.BlazoredVideo.OnChange(ChangeEventArgs args)

This PR fix it.

P.S. onerror is only called with the src attribute, it doesn't work with <source> subelements.

@KellsoHP
Copy link
Contributor Author

@SQL-MisterMagoo, hi, sorry for tag, but can you add your review? :)

<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<PackageReleaseNotes>Initial Release</PackageReleaseNotes>
<Version>1.0.1</Version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version control is added by CI pipeline


public string Message { get; set; }

public override string ToString()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is ToString here really necessary?

SQL-MisterMagoo added a commit that referenced this pull request Jan 3, 2023
@SQL-MisterMagoo SQL-MisterMagoo merged commit e73b21c into Blazored:main Jan 3, 2023
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

Successfully merging this pull request may close these issues.

3 participants