DataBinding to Video tag in Each causes preview to crash

I’m trying to create a list of videos by doing this:

<Each Items="{Items}">
    <StackPanel>
        <Video Url="{MediaUrl}" AutoPlay="false" IsLooping="true" />
    </StackPanel>
</Each>

but it causes preview to crash with this log:

Unexpected fatal error! Please report this to us.
Build started: FullCompile
Configuring (2.28s)
Compiling syntax tree (1.48s)
Generating code and data (1.96s)

Build completed in 5.72 seconds.
    0 Warning(s)
    0 Error(s)
Build ended
GL_VERSION: 2.1 NVIDIA-10.10.5.2 310.42.25f01
GL_VENDOR: NVIDIA Corporation
GL_RENDERER: NVIDIA GeForce GT 750M OpenGL Engine


Preview detected an unhandled exception: System.AggregateException: One or more errors occurred. ---> System.ArgumentException: start_index + length > array length
Parameter name: length
  at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal:copy_from_unmanaged (intptr,int,System.Array,int)
  at System.Runtime.InteropServices.Marshal.Copy (IntPtr source, System.Byte[] destination, Int32 startIndex, Int32 length) [0x00000] in <filename unknown>:0
  at Fuse.Video.Mono.PixelBuffer.UpdateTexture (Int32 textureName, Fuse.Video.Mono.VideoHandle handle) [0x00000] in <filename unknown>:0
  at Fuse.Video.Mono.VideoImpl.UpdateTexture (Fuse.Video.Mono.VideoHandle handle, Int32 textureHandle) [0x00000] in <filename unknown>:0
  at Fuse.Video.Mono.MonoImpl.UpdateTexture (Int32 textureHandle) [0x00000] in <filename unknown>:0
  at Fuse.Video.Graphics.CIL.VideoImpl.UpdateTexture (Fuse.Video.Graphics.CIL.VideoHandle handle, Int32 textureHandle) [0x00000] in <filename unknown>:0
  at Fuse.Video.Graphics.CIL.VideoPlayer.Update () [0x00000] in <filename unknown>:0
  at Fuse.Video.VideoContainer.Update () [0x00000] in <filename unknown>:0
  at Fuse.UpdateListener.Invoke () [0x00000] in <filename unknown>:0
  at Fuse.UpdateManager.Update (Fuse.Stage stage) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at Fuse.UpdateManager.Update (Fuse.Stage stage) [0x00000] in <filename unknown>:0
  at Fuse.UpdateManager.Update () [0x00000] in <filename unknown>:0
  at Fuse.AppBase.OnUpdate () [0x00000] in <filename unknown>:0
  at Outracks.Simulator.Application.OnUpdate () [0x00000] in <filename unknown>:0
  at Fuse.App.Update () [0x00000] in <filename unknown>:0
---> (Inner Exception #0) System.ArgumentException: start_index + length > array length
Parameter name: length
  at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal:copy_from_unmanaged (intptr,int,System.Array,int)
  at System.Runtime.InteropServices.Marshal.Copy (IntPtr source, System.Byte[] destination, Int32 startIndex, Int32 length) [0x00000] in <filename unknown>:0
  at Fuse.Video.Mono.PixelBuffer.UpdateTexture (Int32 textureName, Fuse.Video.Mono.VideoHandle handle) [0x00000] in <filename unknown>:0
  at Fuse.Video.Mono.VideoImpl.UpdateTexture (Fuse.Video.Mono.VideoHandle handle, Int32 textureHandle) [0x00000] in <filename unknown>:0
  at Fuse.Video.Mono.MonoImpl.UpdateTexture (Int32 textureHandle) [0x00000] in <filename unknown>:0
  at Fuse.Video.Graphics.CIL.VideoImpl.UpdateTexture (Fuse.Video.Graphics.CIL.VideoHandle handle, Int32 textureHandle) [0x00000] in <filename unknown>:0
  at Fuse.Video.Graphics.CIL.VideoPlayer.Update () [0x00000] in <filename unknown>:0
  at Fuse.Video.VideoContainer.Update () [0x00000] in <filename unknown>:0
  at Fuse.UpdateListener.Invoke () [0x00000] in <filename unknown>:0
  at Fuse.UpdateManager.Update (Fuse.Stage stage) [0x00000] in <filename unknown>:0 <---


Preview detected an unhandled exception: System.AggregateException: One or more errors occurred. ---> System.ArgumentException: start_index + length > array length
Parameter name: length
  at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal:copy_from_unmanaged (intptr,int,System.Array,int)
  at System.Runtime.InteropServices.Marshal.Copy (IntPtr source, System.Byte[] destination, Int32 startIndex, Int32 length) [0x00000] in <filename unknown>:0
  at Fuse.Video.Mono.PixelBuffer.UpdateTexture (Int32 textureName, Fuse.Video.Mono.VideoHandle handle) [0x00000] in <filename unknown>:0
  at Fuse.Video.Mono.VideoImpl.UpdateTexture (Fuse.Video.Mono.VideoHandle handle, Int32 textureHandle) [0x00000] in <filename unknown>:0
  at Fuse.Video.Mono.MonoImpl.UpdateTexture (Int32 textureHandle) [0x00000] in <filename unknown>:0
  at Fuse.Video.Graphics.CIL.VideoImpl.UpdateTexture (Fuse.Video.Graphics.CIL.VideoHandle handle, Int32 textureHandle) [0x00000] in <filename unknown>:0
  at Fuse.Video.Graphics.CIL.VideoPlayer.Update () [0x00000] in <filename unknown>:0
  at Fuse.Video.VideoContainer.Update () [0x00000] in <filename unknown>:0
  at Fuse.UpdateListener.Invoke () [0x00000] in <filename unknown>:0
  at Fuse.UpdateManager.Update (Fuse.Stage stage) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at Fuse.UpdateManager.Update (Fuse.Stage stage) [0x00000] in <filename unknown>:0
  at Fuse.UpdateManager.Update () [0x00000] in <filename unknown>:0
  at Fuse.AppBase.OnUpdate () [0x00000] in <filename unknown>:0
  at Outracks.Simulator.Application.OnUpdate () [0x00000] in <filename unknown>:0
  at Fuse.App.Update () [0x00000] in <filename unknown>:0
---> (Inner Exception #0) System.ArgumentException: start_index + length > array length
Parameter name: length
  at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal:copy_from_unmanaged (intptr,int,System.Array,int)
  at System.Runtime.InteropServices.Marshal.Copy (IntPtr source, System.Byte[] destination, Int32 startIndex, Int32 length) [0x00000] in <filename unknown>:0
  at Fuse.Video.Mono.PixelBuffer.UpdateTexture (Int32 textureName, Fuse.Video.Mono.VideoHandle handle) [0x00000] in <filename unknown>:0
  at Fuse.Video.Mono.VideoImpl.UpdateTexture (Fuse.Video.Mono.VideoHandle handle, Int32 textureHandle) [0x00000] in <filename unknown>:0
  at Fuse.Video.Mono.MonoImpl.UpdateTexture (Int32 textureHandle) [0x00000] in <filename unknown>:0
  at Fuse.Video.Graphics.CIL.VideoImpl.UpdateTexture (Fuse.Video.Graphics.CIL.VideoHandle handle, Int32 textureHandle) [0x00000] in <filename unknown>:0
  at Fuse.Video.Graphics.CIL.VideoPlayer.Update () [0x00000] in <filename unknown>:0
  at Fuse.Video.VideoContainer.Update () [0x00000] in <filename unknown>:0
  at Fuse.UpdateListener.Invoke () [0x00000] in <filename unknown>:0
  at Fuse.UpdateManager.Update (Fuse.Stage stage) [0x00000] in <filename unknown>:0 <---


Preview detected an unhandled exception: System.AggregateException: One or more errors occurred. ---> System.ArgumentException: start_index + length > array length
Parameter name: length
  at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal:copy_from_unmanaged (intptr,int,System.Array,int)
  at System.Runtime.InteropServices.Marshal.Copy (IntPtr source, System.Byte[] destination, Int32 startIndex, Int32 length) [0x00000] in <filename unknown>:0
  at Fuse.Video.Mono.PixelBuffer.UpdateTexture (Int32 textureName, Fuse.Video.Mono.VideoHandle handle) [0x00000] in <filename unknown>:0
  at Fuse.Video.Mono.VideoImpl.UpdateTexture (Fuse.Video.Mono.VideoHandle handle, Int32 textureHandle) [0x00000] in <filename unknown>:0
  at Fuse.Video.Mono.MonoImpl.UpdateTexture (Int32 textureHandle) [0x00000] in <filename unknown>:0
  at Fuse.Video.Graphics.CIL.VideoImpl.UpdateTexture (Fuse.Video.Graphics.CIL.VideoHandle handle, Int32 textureHandle) [0x00000] in <filename unknown>:0
  at Fuse.Video.Graphics.CIL.VideoPlayer.Update () [0x00000] in <filename unknown>:0
  at Fuse.Video.VideoContainer.Update () [0x00000] in <filename unknown>:0
  at Fuse.UpdateListener.Invoke () [0x00000] in <filename unknown>:0
  at Fuse.UpdateManager.Update (Fuse.Stage stage) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at Fuse.UpdateManager.Update (Fuse.Stage stage) [0x00000] in <filename unknown>:0
  at Fuse.UpdateManager.Update () [0x00000] in <filename unknown>:0
  at Fuse.AppBase.OnUpdate () [0x00000] in <filename unknown>:0
  at Outracks.Simulator.Application.OnUpdate () [0x00000] in <filename unknown>:0
  at Fuse.App.Update () [0x00000] in <filename unknown>:0
---> (Inner Exception #0) System.ArgumentException: start_index + length > array length
Parameter name: length
  at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal:copy_from_unmanaged (intptr,int,System.Array,int)
  at System.Runtime.InteropServices.Marshal.Copy (IntPtr source, System.Byte[] destination, Int32 startIndex, Int32 length) [0x00000] in <filename unknown>:0
  at Fuse.Video.Mono.PixelBuffer.UpdateTexture (Int32 textureName, Fuse.Video.Mono.VideoHandle handle) [0x00000] in <filename unknown>:0
  at Fuse.Video.Mono.VideoImpl.UpdateTexture (Fuse.Video.Mono.VideoHandle handle, Int32 textureHandle) [0x00000] in <filename unknown>:0
  at Fuse.Video.Mono.MonoImpl.UpdateTexture (Int32 textureHandle) [0x00000] in <filename unknown>:0
  at Fuse.Video.Graphics.CIL.VideoImpl.UpdateTexture (Fuse.Video.Graphics.CIL.VideoHandle handle, Int32 textureHandle) [0x00000] in <filename unknown>:0
  at Fuse.Video.Graphics.CIL.VideoPlayer.Update () [0x00000] in <filename unknown>:0
  at Fuse.Video.VideoContainer.Update () [0x00000] in <filename unknown>:0
  at Fuse.UpdateListener.Invoke () [0x00000] in <filename unknown>:0
  at Fuse.UpdateManager.Update (Fuse.Stage stage) [0x00000] in <filename unknown>:0 <---
/usr/local/bin/fuse: line 2: 32847 Killed: 9               /Applications/Fuse.app/Contents/MacOS/Fuse "$@"

What happens in device preview and regular export?

On a side note: I’m pretty sure that having multiple videos active at once will be problematic on some (possibly quite a lot) of mobile devices.

On device preview(iOS) it behaves similarly. On regular export(iOS) it does not crash, but the video tags don’t seem to be layouted to the screen at all…

I’m only using this for some visual prototyping, and don’t intend this to be in our production app, however i don’t see why it should be a problem to have a list of video elements if only one of them is playing at a time like Instagram, Vine etc. How would you suggest implementing a scrollable list of videoes?

The main reason for this bug report however was that the output stated Unexpected fatal error! Please report this to us.

Thanks for the additional info! (As the video playback depends on completely different backends on each platform it’s good to have some more data points).

I’m only using this for some visual prototyping, and don’t intend this to be in our production app, however i don’t see why it should be a problem to have a list of video elements if only one of them is playing at a time like Instagram, Vine etc.

My comment was specifically about having multiple active videos at the same time. :slight_smile:

That said, if it turns out that having multiple inactive video elements on-screen at the same time is also a problem (which might happen if each of them allocate some form of limited hardware resource), then it should be fairly easy to just use regular images for each of the elements and then simply have one video element which is moved into place and initialized when a video is started.

By “causes preview to crash”, do you mean that the entire previe app crashes, or do you at least get the error screen?

The error screen shows up. I think me and Vegard figured out the problem. I was using NativeTheme, and as he informs me VideoElement ins’t implementet for this. I wrapped it in a GraphicsView and everything seems fine. Don’t know how good this is for performance though…