Video
Video copied to clipboard
Fix cast MediaError to C# object
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.
@SQL-MisterMagoo, hi, sorry for tag, but can you add your review? :)