Search Unity

[Released] AVPro Video - complete video playback solution

Discussion in 'Assets and Asset Store' started by AndrewRH, Feb 12, 2016.

  1. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    So we have moved this issue over to GitHub Issues here:
    https://github.com/RenderHeads/UnityPlugin-AVProVideo/issues/68

    It seems to be related to Safari and videos that contain audio.

    Thanks,
     
  2. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    For others who are interested in this issue, we've moved this issue to GitHub Issues here:
    https://github.com/RenderHeads/UnityPlugin-AVProVideo/issues/65
     
  3. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Which platform is this on? :)
    Which version of Unity?
    Which version of AVPro Video?
    What are the specs of your video (resolution, frame-rate, codec etc)?
    What are the specs of your hardware (CPU, GPU)?

    Thanks,
     
  4. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Did you set the file offset value in the MediaPlayer > Platform Specific > Android settings?
    Did you try changing the video API from ExoPlayer to MediaPlayer? (also in Platform Specific > Android settings)

    Thanks,
     
  5. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Sort of. It's not really a feature of the player, but you can try.

    We include a sample called PlaybackSync.cs which you can look at.

    It doesn't do frame-perfect sync, but pretty close. For frame-perfect sync you need to use the texture timestamp values (in mediaPlayer.TextureProducer.GetTextureTimeStamp()) and probably keep a buffer of them for both players and then decide to play the frames with the same timestamp values. It's quite a lot of work to get a good sync system going.

    It's also a lot easier to do if you're using videos that aren't heavily compressed - ones with lots of keyframes (or all keyframes), so that random seeking is FAST.
     
  6. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Thanks very much for sharing!
    We're actually not using hardware decoding on D3D9, only D3D11.
    I don't know if we still have any issues with color shifting, but it is possible. We have a DirectShow D3D9 and D3D11 path, and also a Media Foundation D3D11 path so we would need to test them all. It also depends on the video and color-range...some of these API's handle them better than others...
    Thanks again for the tips, we're going to look into this a bit further - very helpful
     
  7. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    We have an issue for this:
    https://github.com/RenderHeads/UnityPlugin-AVProVideo/issues/70

    Feel free to post the video there so we can take a look.

    It would still be great to know which platform you're on. The editor can run on Windows, macOS or Linux, and the behaviour is different depending on the platform because we're running different per-platform code for the video playback.

    Thanks,
     
  8. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    I would recommend HLS for streaming. It has the best compatibility across platforms and is basically the industry standard. MPEG-DASH is another option, but it is not supported by Apple products and there is also a licensing fee.

    I don't really have any VR streaming tips for you. We are not streaming specialists. Video is a massive subject so there is always a lot to learn.

    We have found tools like MP4 Box, Bento4, FFMPEG to be invaluable.
     
  9. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    I've posted the issue here for you.

    https://github.com/RenderHeads/UnityPlugin-AVProVideo/issues/64

    I hope this information is helpful to you.
     
  10. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    We have no plans to support it.
    We tried, but it seems too difficult :)

    Thanks,
     
  11. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Yes, sadly it's not that simple. We don't have control over what Media Foundation is doing under the hood. For now if you want to use Media Foundation with 3D stereo content then it must not contain the stereo metadata. We talk more about this in the PDF documentation. In version 2.0 of the plugin we have a solution that handles stereo without this issue, hopefully it'll be out "soon".
     
  12. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    For buffering - it depends on what type of content you're trying to play (streaming MP4, HLS)? If you're using HLS then it's probably best to add in the HLS.JS library (as described in the PDF documentation), as they probably has better buffering handling than the default browser implementation, and will also give you more consistency results across browsers.

    There is currently no way to explicitly tell it to continue buffering when paused. This behaviour again is browser dependent.

    Yes, in WebGL they don't expose the video frame rate sadly.

    The Safari issue is related to security settings in Safari. It will not play videos that contain audio. So you need to either remove the audio, or got to Settings and allow the video playback on that specific site.
     
  13. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    The Stalled event fires when the video is trying to play, but the frame isn't available for decoding. This usually happens when the frame has not been downloaded over the network yet. If you could give more details about your platform and how/when this happens then we may be able to offer more insight.

    Thanks,
     
  14. synthesisvr

    synthesisvr

    Joined:
    Dec 19, 2018
    Posts:
    3
    Hi Andrew,

    I have 360 stereoscopic video (4k X 4k) that I want to play in VR. I'm using the 360 Sphere demo scene and I'm unable to find how to play it in Stereoscopic mode. All I get is monoscopic. I'm using AV Pro for Windows.

    The documentation seems to suggest to set stereo on the material.. but there isn't any material with the demo scene.

    Could you point me in the right direction?
     
  15. mikerz1985

    mikerz1985

    Joined:
    Oct 23, 2014
    Posts:
    66
    The plugin works great, I'm just running into use case issues.

    Do you have any recommendations for playing back 4k or larger videos using DirectShow and LAV Filters? There doesn't seem to be much of a difference if hardware decoding is on or off in the LAV Video Decoder.

    The goal is to play back h265 and ProRes videos at a realtime rate on a Windows machine. Alternatively, is it even possible to write or adapt a performant ProRes decoder for Media Foundation?
     
  16. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Is there a chance you could send a reproducible project ?
    I've posted issue to the GitHub Issues so our developer can take a look at the issue in detail.
    https://github.com/RenderHeads/UnityPlugin-AVProVideo/issues/71

    Thanks,
     
  17. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Yes, currently stereo videos that contain stereo metadata don't display correctly in AVPro Video on Windows desktop. To get around this you need to remove the stereo metadata from the videos, or create them without this metadata. There is a section in our PDF documentation that covers this in more detail.

    Here is an excerpt from the FAQ:

    Windows - Why isn’t my stereo top-bottom or left-right video displaying correctly?

    If your stereo video is only decoding one of the views then this is because there is stereo metadata encoded within the video which causes our Media Foundation decoder to interpret incorrectly. The only way to currently solve this is to remove the metadata from the video. One way to do this is using FFMPEG:

    ffmpeg -i %1 %1-video.nut
    ffmpeg -i %1-video.nut -crf 10 %1-stripped.mp4

    We have also had reports that this works:

    ffmpeg -i in.mp4 -map_metadata -1 -c:v copy -c:a copy out.mp4

    Thanks,
     
  18. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Yes, our DirectShow implementation is software only, so it will not use hardware decoding.

    I would recommend using H.265 with an NVidia 10xx or 20xx series GPU, if you want to decode up to 8K frames. For this you would need to use the Media Foundation API.

    For larger I would recommend the Hap codec (which requires DirectShow, but not LAV Filters).

    ProRes isn't open source so I don't know how legal it would be to try to write a plugin for this...
     
  19. synthesisvr

    synthesisvr

    Joined:
    Dec 19, 2018
    Posts:
    3
    Thanks Andrew! This made it.
    I will suggest to add to the documentation the "stereoscopic" and "monoscopic" words, as this is how I was browsing the documentation prior writing here.
     
  20. samizzo

    samizzo

    Joined:
    Sep 7, 2011
    Posts:
    482
    Thanks, it'll take a couple of days due to other commitments but I'll try to build a small reproducible project!
     
  21. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Thanks, that'd help a lot! Please email it to unitysupport@renderheads.com

    We'll post updates on the GitHub Issues page
     
  22. Anthomaxyd

    Anthomaxyd

    Joined:
    Apr 8, 2019
    Posts:
    5
    Hello Andrew! I've just purchased AVPRO android and it's awesome, but i've got some issues with it. I'm currently using it in an unity app with sphere display. This app is used for (among others) displaying a 4k equirectangular stereo video in a samsung S8 with the help of a gear VR. The video is an mpeg4(with xvid codec) since it run better in unity than h264 and h265 codec. But i can't get the video to play smoothly (even in 3k). So i was wondering if you have any idea how to improve my video fluidity when played in AVPRO? Can cubemap video improve the GPU usage?
    The second issues concern the sound display. For now i'm using the facebook TBE player outside AVPRO, because encapsulating sound in a mkv container cause the video the video to stutter even more. Is this normal, like is mkv more difficult to read than mpeg-4? FYI , i'm using FB360 for mixing mpeg-4 video and audio into a mkv container, and the lowest quality video i'v tested is a 1,4g Go mpeg- video, with xvid codec, mbps, equirectangular stereo convert with ffmpeg. I've also tested video in h264 and h265 in order to compare.
    Have a nice day from France!
     
  23. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Greetings :)

    I'm really surprised to hear that mpeg4 was chosen over H.264 / H.265. I think the hardware probably has better support for the newer codecs. Certainly at high resolutions it's optimised for H.264 / H.265 from what I've heard.

    Using cubemap video layout will give about a 15% quality improvement for the same file size and performance.

    There are a few things you could try with the Go to improve performance:

    1) creating the CPU and GPU level (via Oculus script)
    2) Enable OES rendering mode in the MediaPlayer (in Platform Specific > Android section)

    I think the FB360 MKV decoder favours perfect audio at the expense of video, so it can drop frames sometimes. You're probably best to go with playing the two medias independently, as long as you start them at the same time so there is minimal drift.
     
  24. Anthomaxyd

    Anthomaxyd

    Joined:
    Apr 8, 2019
    Posts:
    5
  25. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Hi All,

    AVPro Video version 1.9.16 has just been released!

    You can find the updated version on the Asset Store and the free trial version on our website.

    Changes include:

    UWP / Hololens
    • Fixed crash bug which was a regression introduced in 1.9.12
    • Fixed compiler warning in 2019 for deprecated HLSStream WWW class usage
    Android
    • Fixed resource leak when using MediaPlayer API where FileInputStream was not closed
    • Fixed bug where subsequent video loads would always play automatically
    • Various logic changes to reduce bugs
    WebGL
    • Improved Safari support - videos containing audio that don’t have permission to autoplay will now log an error and attempt to play with audio muted
    General
    • DisplayUGUI component now uses lazy evaluation for shader loading which improves loader performance in most cases

    Thanks to everyone that reported bugs that were fixed in this release :)

    Please report any issues here on the forum, or preferably to our Github Issue tracker

    Thanks,
     
  26. applet_llc

    applet_llc

    Joined:
    Feb 1, 2018
    Posts:
    2
    Hi, I am developing an app named #ChannelPlayer, which is a VR Move player. Ported to Shader from Shader code under MIT license to support FishEye180 Side by Side. I placed the source at the following URL. As HIGH_QUALIY and scaleOffset are not working yet, it would be appreciated if you could comment etc.

    AVProVideo-VR-InsideSphere-Transparent.shader
    https://appletllc.wordpress.com/2019/06/04/fisheye180-side-by-side対応/
     
  27. Kareeem

    Kareeem

    Joined:
    Mar 1, 2013
    Posts:
    30
    Hi There!
    Getting several Errors after import the TrialPackage into 2018.3.14f1


    Assets\AVProVideo\Demos\Scripts\SphereDemo.cs(40,8): error CS0619: 'VRDevice' is obsolete: 'VRDevice has been moved and renamed. Use UnityEngine.XR.XRDevice instead (UnityUpgradable) -> UnityEngine.XR.XRDevice'


    Assets\AVProVideo\Demos\Scripts\SphereDemo.cs(63,8): error CS0619: 'VRDevice' is obsolete: 'VRDevice has been moved and renamed. Use UnityEngine.XR.XRDevice instead (UnityUpgradable) -> UnityEngine.XR.XRDevice'


    Assets\AVProVideo\Demos\Scripts\SphereDemo.cs(68,6): error CS0619: 'InputTracking' is obsolete: 'InputTracking has been moved. Use UnityEngine.XR.InputTracking instead (UnityUpgradable) -> UnityEngine.XR.InputTracking'


    Assets\AVProVideo\Demos\Scripts\SphereDemo.cs(73,6): error CS0619: 'VRSettings' is obsolete: 'VRSettings has been moved and renamed. Use UnityEngine.XR.XRSettings instead (UnityUpgradable)'

    Assets\AVProVideo\Demos\Scripts\SphereDemo.cs(73,43): error CS0619: 'VRSettings' is obsolete: 'VRSettings has been moved and renamed. Use UnityEngine.XR.XRSettings instead (UnityUpgradable)'
     
  28. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    303
    Hi =) I was just wondering if I could put in some small code change requests. Every time we update the plugin I have to reapply a couple of tiny edits which I believe would be to the benefit of anyone doing PS4 development.

    I'm fairly certain the file: AVProVideo-BlendFrames.shader needs exclusions added for ps4 and xboxone:
    Code (CSharp):
    1. #pragma exclude_renderers flash xbox360 ps3 gles xboxone ps4
    and would it be possible that this line is commented out? it throws errors every time when the plugin is updated and the build platform is set to PS4:
    Code (CSharp):
    1. mediaPlayer = new PS4MediaPlayer();
    No worries if not, it's not big deal to redo them. Just something I've had to do a dozen times and it'd be great to be able to updated without needing a maintenance task.
     
  29. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    It looks like you selected "No" when Unity asked you whether you wanted to automatically upgrade any scripts during the import of the unitypackage.

    Most of those are easy to fix - you just need to edit the scripts and change VRDevice to UnityEngine.XR.XRDevice, and VRSettings to UnityEngine.VR.XRSettings.

    Or you could simply delete the files and import the asset and allow Unity to convert for you.
     
  30. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    We can certainly look into that for the next release! :)

    Why do you need to add those exclusions for the BlendFrames shader? Is there something there that fails to compile on the PS4 and XBoxOne platforms? I need to know the reason for this before we can make the change.

    Yes I think we can remove the PS4MediaPlayer line :)
     
  31. SteenPetersen

    SteenPetersen

    Joined:
    Mar 13, 2016
    Posts:
    28
    Hi I am having an issue with AVpro trial version:

    I am trying to simply load a file from my oculus quest headset and run it on startup. I know for a fact that the file is there as my debug tells me so and furthermore I have made it run on the unity default videoplayer. Nothing happens however when I try, besides printing the path and saying, "File has been found!". I just get an empty scene.

    This is built using the demo scene 13 by simply adding a script that does the following:

    Code (CSharp):
    1.  
    2.             _mp = GetComponent<MediaPlayer>();
    3.  
    4.             if (Application.platform == RuntimePlatform.Android)
    5.             {
    6.                 rootPath = Application.persistentDataPath.Substring(0, Application.persistentDataPath.IndexOf("Android", StringComparison.Ordinal));
    7.                 path = Path.Combine(Path.Combine(rootPath, "Android/Data/_Videos"), fileName);
    8.             }
    9.  
    10.             _debugText.text += rootPath + "\n";
    11.             _debugText.text += path + "\n";
    12.  
    13.             if (File.Exists(path))
    14.                 _debugText.text += "\nFile has been found!\n\n"
    15.  
    16.             _mp.OpenVideoFromFile(MediaPlayer.FileLocation.AbsolutePathOrURL, path);
    17.  
    18.             _mp.Play();
    I have checked and this code works in the editor just fine if I give it a path to a file on my computer. So I know this should work, and I know the file is on the headset at that location. so something mysterious is going on.
     
    Last edited: Jun 6, 2019
  32. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    303
    Thanks.. and sorry I'll have to get back to you on that one. The exact technical reason escapes me right now, but will be able to find out over the next few days. It's just been a while since I've touched that code. I'll need to test something out and let you know when I can, thanks.
     
  33. Anthomaxyd

    Anthomaxyd

    Joined:
    Apr 8, 2019
    Posts:
    5
    Hello Andrew! Hope you get well. Since your last message, i've tried OES path on my video. The good things is that the fluidity of the video is over the top, the not so good news is that i have now some frame rate with my camera (when i turn my head the video seems to jump, like a shaky result). Any idea why? I've used the sphere OES path shader include with AVPRO, the video is a 3k, 40 mpbs H264 stereo equirectangular.
    Thanks in advance,
    Thomas
     
  34. Joha2nes

    Joha2nes

    Joined:
    Mar 16, 2013
    Posts:
    2
    Hi! We have some problems playing videos in WebGL with this asset using an iPad. Is this supported? We used the free trial version too make sure the asset worked or not before buying the paid version, and trying the demo scenes built to WebGL on an iPad using safari, firefox and chrome.
     
  35. round4usrl

    round4usrl

    Joined:
    Jun 12, 2018
    Posts:
    1
    Problem description:

    I created a Unity project in which is possible to play a 360 video, the application is built for Android; for the Oculus GO.
    During the video playback into the Oculus GO, the texture shows some artefacts similar to the aliasing effect and there is also a lateral dragging of the frames.
    I'd like to say that if I play the same video by using the Oculus Gallery app, I don't have any artefacts.
    May the problem is in the decoding process? Can you tell me something more about it?
    Thank you for the support

    Claudio

    Device (which devices are you having the issue with - model, OS version number):

    Oculus GO

    Media (tell us about your videos - number of videos, resolution, codec, frame-rate, example URLs):

    the number is not so important because I have this problem even with only one Video Player.
    The Video is: 3840x2160, H264, 60FPS,
    link to video: https://drive.google.com/open?id=1DdjNOS0214P6tGW5wVrMpWTfbWJ5Xufs

    System Information:

    AVPro Video: plugin v1.9.12 scripts v1.9.12
    Target Platform: Android
    Unity: v2018.3.2f1 WindowsEditor
    OS: Desktop - Precision 7920 Tower (Dell Inc.) - Windows 10 (10.0.0) 64bit - Italian
    CPU: Intel(R) Xeon(R) Gold 6128 CPU @ 3.40GHz - 24 threads - 32410KB
    GPU: Emulated GPU running OpenGL ES 3.0 - Emulated - OpenGL ES 3.0 [emulated] - 11127KB - 4096
     
  36. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    If you use a differnt video does it still jump? I'm just wondering if it has something to do with playing back a heavy video affecting the rest of the system....
    Which device is it you're running on? Did you try including the GPU/CPU level of the device?
     
  37. danielesuppo

    danielesuppo

    Joined:
    Oct 20, 2015
    Posts:
    168
    Hello Andrew,
    I've noticed that when AVPro is streaming some videos on WebGL, expecially on mobile, it may show the wrong frame (I mean that GetCurrentTimeMs is right, but what you see is a lot of frames before the right one - more than 20 seconds).
    This is particulary true if the player is struggling to play the video.
    Next, if you Pause the video and you wait some time, it will show the right frame.
    Is it possible to force the player to show the right frame, dropping the frames that it is not able to play, so to have always syncronized the video with the currentTime ?
    Or, at least, is it possible to know when the video get de-syncronized with the time, and for how many seconds, so to reduce the playback rate until it get in sync again?
    Or, maybe, force a re-sync each, for example, 5 seconds?
    Thank-you!
     
    Last edited: Jun 7, 2019
  38. danielesuppo

    danielesuppo

    Joined:
    Oct 20, 2015
    Posts:
    168
    Playing HLS videos (with "hls.min.js") on Chrome for Android, when I load a new video I get this error:
    "Uncaught InvalidStateError: Failed to read the 'buffered' property from 'SourceBuffer': This SourceBuffer has been removed from the parent media source".

    Any advice for this issue?
    Thanks!
     
  39. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    What's the problem? We support webgl...so it depends on how feature-ful the browser is. We've tested on some versions of browsers on iPad in the past and it's been fine, but we haven't tested recently..
     
  40. danielesuppo

    danielesuppo

    Joined:
    Oct 20, 2015
    Posts:
    168
    How do you interact with hls.min.js ?
    Maybe the library is still looking to the buffer, and when the video is closed it thrown this error "Failed to read the 'buffered' property from 'SourceBuffer'...".
    What is weird is that it does not happen every time, sometimes the 1st time I load a new video, sometimes after 6 or 7 new videos loaded... o_O
     
  41. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Hi!

    hmm, I'm not sure what the problem could be...Your code looks okay to me.

    I am surprised though that you're rolling your own code for this. I think the MediaPlayer component should already handle loading from the PersistentData path.

    In the MediaPlayer component, scroll to the Platform Specific section and click on Android. Here you can tick the "Override" option for the file location, set the location to "Relative to Persistent Data" and then put in the folder and file path you want to load, eg "_Videos/myFile.mp4".

    If you want to set this via code, you can do something like:

    Code (CSharp):
    1. mediaPlayer.PlatformOptionsAndroid.overridePath = true;
    2. mediaPlayer.PlatformOptionsAndroid.pathLocation= MediaPlayer.FileLocation.RelativeToPeristentDataFolder;
    3. mediaPlayer.PlatformOptionsAndroid.path = "_Videos/myvideo.mp4";
    I hope this helps. I would try this above...Let me know if you're still having problems.

    Also how are you getting your video into this folder? Usually you would have to have code that downloads the file into this application specific path.

    Thanks,
     
  42. SteenPetersen

    SteenPetersen

    Joined:
    Mar 13, 2016
    Posts:
    28
    I tried this and it gave me the same error. I went back to my code (as I have a hard time logging what the exact path is that the built in methods are using). I was prompted to do so when I was reminded by AVpro error log that it doesn't support single pass and that got me one step closer. I was now at least not in an empty scene but inside the black sphere upon which I project the video.

    I then added some error handling:

    Code (CSharp):
    1.  {
    2.             _mp = GetComponent<MediaPlayer>();
    3.             _mp.Events.AddListener(OnVideoEvent);  // added this to handle errors
    4.  
    5.  
    6.             if (Application.platform == RuntimePlatform.Android)
    7.             {
    8.                 rootPath = Application.persistentDataPath.Substring(0, Application.persistentDataPath.IndexOf("Android", StringComparison.Ordinal));
    9.                 path = Path.Combine(Path.Combine(rootPath, "Android/Data/_Videos"), fileName);
    10.             }
    11.             else
    12.             {
    13.                 path = "D:\\Misc\\DOWNLOADS_D_Drive\\3K_og_6.52min.mp4";
    14.             }
    15.  
    16.             _debugText.text += rootPath + "\n";
    17.             _debugText.text += path + "\n";
    18.  
    19.             if (File.Exists(path))
    20.                 _debugText.text += "\nFile has been found!\n\n";
    21.  
    22.  
    23.             _mp.OpenVideoFromFile(MediaPlayer.FileLocation.AbsolutePathOrURL, path);
    24.             _mp.Play();
    25. }
    26.  
    27.  public void OnVideoEvent(MediaPlayer mp, MediaPlayerEvent.EventType et, ErrorCode errorCode)
    28.     {
    29.         switch (et)
    30.         {
    31.             case MediaPlayerEvent.EventType.ReadyToPlay:
    32.                 mp.Control.Play();
    33.                 break;
    34.  
    35.             case MediaPlayerEvent.EventType.FirstFrameReady:
    36.  
    37.                 Debug.Log("First frame ready");
    38.                 break;
    39.  
    40.             case MediaPlayerEvent.EventType.FinishedPlaying:
    41.                 mp.Control.Rewind();
    42.                 break;
    43.         }
    44.  
    45.         _debugText.text += "Event type: " + et.ToString() + " Code: " + errorCode + " \n" ;
    46.     }
    47.  
    48.  

    Inside the unity editor this is the text that I get, it works wonderfully and logs the following:

    D:\Misc\DOWNLOADS_D_Drive\3K_og_6.52min.mp4

    File has been found!

    Event type: StartedBuffering Code: None
    Event type: MetaDataReady Code: None
    Event type: FirstFrameReady Code: None
    Event type: ResolutionChanged Code: None
    Event type: FinishedBuffering Code: None
    Event type: Started Code: None


    Inside the headset however, this is the log I get:

    com.steen.thesis-20190609-101210.jpg

    perhaps you will understand better than I why it would be calling closing to start with.

    I simply drag and drop the file onto the headset like you would an external harddrive.
     
  43. ssuniljust4u

    ssuniljust4u

    Joined:
    Jun 27, 2016
    Posts:
    3
    Hi,

    Can you support long file path, i have a requirement to play videos which are saved in longpath > 400 characters. Win10 support is limited to 250+ chars only. I have used some native methods to validate files and also am able to load images, but AVPro won't find videos with longpath. will there by any support for this issue? i don't want client to change there win10 settings.

    BR,
    Sunil
     
    Last edited: Jun 10, 2019
  44. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Hi, we haven't had a chance to look into this yet. Will get back to you shortly.
     
  45. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Hmm...Perhaps it's a bug in the current version. Are you able to play the demo scenes with the sample media files which are in StreamingAssets folder?

    If you change the video API from ExoPlayer to MediaPlayer (in MediaPlayer > Platform Specific > Android) does that change the behaviour?

    Thanks,
     
  46. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    1) Which version of AVPro Video are you using?
    In 1.9.16 we added improved support for Safari, since Safari by default will not play videos via code if the video contains an audio track.

    2) What sort of problems are you having? Do you have the console log?

    3) Which version of Unity are you using?

    4) Have you tried building our demo scenes?
     
  47. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Have replied about this via email :)
     
  48. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    That's strange. It looks like the video hardware just isn't powerful enough to keep up... Unfortunately HTML5 doesn't give you a lot of control or oversight on the video playback. We don't get an event when the frame is updated, or even what rate it is able to display, so it's really hard to know if it is struggling with the decoding.

    Hmm...by "new video" do you mean that you already have a video playing fine, and then you resuse the same MediaPlayer to play a second video? And does this error cause the video not to play?

    Which version of HLS.JS are you using? The last version we were testing with was 0.10.1

    We only interact with HLS.js during the loading phase.
    AVProVideo.jslib, line 57

    Code (CSharp):
    1.             var hls = new Hls();
    2.             hls.loadSource(path);
    3.             hls.attachMedia(vid);
    4.             hls.on(Hls.Events.MANIFEST_PARSED,function()
    Perhaps we should also be doing something when the video is Closed...hmmm!
     
  49. SteenPetersen

    SteenPetersen

    Joined:
    Mar 13, 2016
    Posts:
    28
    Making a build that completely ignores my script and simply uses the sample media files in the streaming asset folder (Setting "relative to streaming asset folder" in the Source Path and then "AVProVideoSamples/SampleSphere.mp4" in the path) has the same exact issue in the oculus quest headset. Completely black screen. I tried with exoplayer AND mediaplayer both have the same result.


    Changing to MediaPlayer instead of EXOplayer with my script gave me the following debug info:

    com.steen.thesis-20190610-123736.jpg

    Interestingly the sound was playing but no image.
     
  50. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Yes, like many other libraries (even .NET 4.x in Unity), AVPro Video doesn't support such long paths. You would either need to change that registry key in Windows 10 to enable long paths (not sure even this would work though), or use create a subst/mapped drive to the base level folder so that the path is much shorter. Eg if you have c:\verylongpath\anotherlongpath\videos then you would map/subst c:\verylongpath\anotherlongpath to G: and then access all content via G:\videos

    Otherise you would need to find a way to resolve those long paths in DOS 8.3 style paths. You can do this by:

    Opening MediaPlayer.cs and finding the method GetPathformFilePath() at around line 1508. Replace the method with the following:

    Code (CSharp):
    1.     #if (UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN)
    2.         [System.Runtime.InteropServices.DllImport("kernel32.dll", CharSet = System.Runtime.InteropServices.CharSet.Unicode, EntryPoint = "GetShortPathNameW", SetLastError=true)]
    3.         private static extern int GetShortPathName([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)] string pathName,
    4.                                                     [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)] System.Text.StringBuilder shortName,
    5.                                                     int cbShortName);
    6.     #endif
    7.  
    8.         private string GetPlatformFilePath(Platform platform, ref string filePath, ref FileLocation fileLocation)
    9.         {
    10.             string result = string.Empty;
    11.  
    12.             // Replace file path and location if overriden by platform options
    13.             if (platform != Platform.Unknown)
    14.             {
    15.                 PlatformOptions options = GetCurrentPlatformOptions();
    16.                 if (options != null)
    17.                 {
    18.                     if (options.overridePath)
    19.                     {
    20.                         filePath = options.path;
    21.                         fileLocation = options.pathLocation;
    22.                     }
    23.                 }
    24.             }
    25.  
    26.             result = GetFilePath(filePath, fileLocation);
    27.  
    28.             #if (UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN)
    29.             // Handle very long paths by converting to DOS 8.3 format
    30.             if (result.Length > 200 && !result.Contains("://"))
    31.             {
    32.                 string pathToken = @"\\?\";
    33.                 result = pathToken + result.Replace("/","\\");
    34.                 System.Text.StringBuilder sb = new System.Text.StringBuilder(2048);
    35.                 if (0 != GetShortPathName(result, sb, 2048))
    36.                 {
    37.                     result = sb.ToString().Replace(pathToken, "");
    38.                     Debug.LogWarning("[AVProVideo] Long path detected. Changing to DOS 8.3 format");
    39.                 }
    40.             }
    41.             #endif
    42.  
    43.             return result;
    44.         }

    We'll include this in the next plugin update.

    Thanks,
     
unityunity