Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

[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,637
    Hi, no I'm afraid that isn't possible. We don't support passing data chunks into the player, via unitywebrequest or anything. For live streaming we support the standards HLS (.m3u8) and MPEG-DASH (.mpd). You could MAYBE download an mp4 file (encoded with fast-start) manually to disk and then play from that file file as it is being written to, but this is not something we official support or have tested, so if tries to play a region that isn't buffered yet it could crash..

    Thanks,
     
  2. kuchida

    kuchida

    Joined:
    Dec 25, 2012
    Posts:
    5
    Hi!

    We are using AvPro for Windows and
    if I try to download and play 5 GB video from the local server by HTTP progressive download, loading error will occur when the downloaded data exceeds 4 GB.
    Any suggestion how to solve the problem??

    Thanks.
     
  3. jpienbro_apollojourney

    jpienbro_apollojourney

    Joined:
    Jul 20, 2017
    Posts:
    11
    We tried setting a different capture rate and frame rate in our native Android plugin for highspeed recording (ex. captureRate: 240 fps and frameRate: 30 fps). This does work on some devices, but not on all. On some devices the output video file just has the same frameRate value as the captureRate.
    So I looked at what the native Android Camera app outputs when using slowmotion recording mode and it just outputs a highspeed video file with the same frameRate as the capture rate. Probably always playing it with a lower playbackRate (for ex. 240fps recording with playbackRate 0.25x so it uses 60fps).

    I was wondering if it's possible to let the display rate always by 60fps for a 240 fps recording independent of the playbackRate. In theory it would then just skip a lot of frames (and not load them in the buffer).
     
  4. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    Is the video file an MP4? Is is encoded using "fast-start"? Fast-Start enables the video to start streaming immedaitely without having to download the whole file first.

    Which local server are you using? It sounds like a bug in the server...Have you tried uploading it to the internet to see if you're still having problems?

    Which version of AVPro Video and Windows are you using?

    Thanks,
     
  5. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    The decoder can't skip frames, because frames are interdependent, so it must decode all of them. Have you tried both ExoPlayer and MediaPlayer video API's? Perhaps you could try both?

    Thanks,
     
  6. jnroesch

    jnroesch

    Joined:
    Feb 2, 2018
    Posts:
    5
    Hey there, I have both the iOS and the Android package. I would love to switch 'force file format' to either HLS or MPEG DASH per script depending on the current build target. The attribute is listed as a private serialize field in the MediaPlayer-Component and writing my own method to set this attribute seems to work so I was wondering why you do not support this natively?
     
  7. donna13

    donna13

    Joined:
    Dec 30, 2015
    Posts:
    2
    Hi, I am currently using AVPro for a 360 video project.

    I experience a problem related to the display of a 360 video on an inverted sphere. It looks puffy / round. As if the camera is placed too close to the video or the video texture is placed on a sphere that is too small.

    Reproduce:
    1. Open the demo scene 08_Demo_360SphereVideo
    2. Click Play (> Demo scene works!)
    2. Put the asset to be tested (see file: testVideoAVProLooksPuffy.mp4, download on https://www.dropbox.com/s/xphoou0ytobwg0p/testVideoAVProLooksPuffy..mp4?dl=0) in the folder 'StreamingAssets' .
    3. Replace the source path of the AVPro Video Media Player so that it points to the new video (testVideoAVProLooksPuffy.mp4).
    3. Change Packing to top bottom in Stereo
    4. Click Play

    Expected:
    Video starts playing. Straight edges in the footage, look straight in the Unity player as well.

    Actual behaviour:
    Video starts playing but straight edges in the footage (such as the edge between the wall and the ceiling) look 'puffy' / 'round' when playing them as 360 degree footage in the 360SphereVideo demo.



    Tried out solutions:
    Increasing the scale of the sphere inside AVPro Video Media Player object to 100,100,100 instead of 1,1,1 seems to fix the issue in the Unity Editor. However, when viewing the apk on Oculus Go (our target device), the video quality seems really low in that case.

    Question:
    What would be possible solutions? Maybe we need to adapt either the sphere or the mapping of the video onto the sphere so that it corresponds with the video's characteristics (maybe we need to change something based on the resolution of the video for example?)

    We are still using the trial version, but will buy the full package if it fits all our needs. - Unity version: 2018.2.5f1 (pro)
     
  8. donna13

    donna13

    Joined:
    Dec 30, 2015
    Posts:
    2
    There are two images in my post that cannot be loaded, but here is an image of what I want to achieve: : https://ibb.co/fQQUPe

     
  9. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    This usually happens because the camera/sphere is offset and not at the same position. This is usually caused by the VR system adding a "sit" or "stand" height offset to the camera position. In the latest version of AVPro Video we added a new option to the SphereDemo component called "Zero Camera Position" which resets the camera to 0,0,0 each frame so that it is in the center of the sphere. If you're using any OVR components then those also usually have an option to disable positional tracking/offsetting...

    I hope this helps you. Let me know if that doesn't solve it for you.

    Thanks,
     
  10. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    Ahh thanks, this is just an oversight. We will expose it as a public property in the next release.

    Thanks,
     
  11. richardzzzarnold

    richardzzzarnold

    Joined:
    Aug 2, 2012
    Posts:
    93
    Hi I am wondering how to go about adjusting the offset of the VideoMappingMaterial during playback.
    I have changed the VideoMappingMaterial to a standard shader and am trying to adjust the offset through the ApplyToMaterial script.

    but the material is not repeat tiling as it would with a static image. I am getting horizontal lines on either side of the video playback area. Is there any way I can get a repeated image on offset?

    I thought that changing the texture wrap to repeat or mirror in the MediaPlayer would have some effect but it does not seem to.


    thanks
     
    Last edited: Sep 5, 2018
  12. richardzzzarnold

    richardzzzarnold

    Joined:
    Aug 2, 2012
    Posts:
    93

    I see to have achieved realtime offsetting somehow ( disabling resampled?....not sure).
    The main problem now is that texture wrap = mirroring does not seem to work.
    How can I mirror the video image? I have bilinear filter and Mirror wrap but it is not mirroring.
     
    Last edited: Sep 5, 2018
  13. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    Thanks for reporting this. This was a bug in the reamples, and also in the OSXMediaPlayer class. I've emailed you the details on how to fix this. The fix will appear in the next release of the plugin.

    Thanks,
     
  14. ibps13

    ibps13

    Joined:
    Oct 6, 2012
    Posts:
    113
    Hi,

    I'v some problem with android gearvr app and last version of AvPro, 360 video are playing correctly but simple video on UGUI is not played. screen is white. Videos works fine on Editor... I'v tried to change Mediaplayer or Exoplayer etc... nothing work.

    If I put video on StreamingAssetsFolder, I only have the first image of video, and video not playing
    If I put on AssetDataPath, white screen...

    Tested on Android 8, samsung S6 and S8+

    I use unity 2018.2.5f1 and AvPro 1.9

    Any clue ?
     
  15. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    That seems strange....Does our UGUI demo scene work with our sample videos?
    Are the files very large? StreamingAssets folder is memory mapped AFAIK so it can use a lot of system memory to stream files from it. Or perhaps you could tell us more about the video specs (resolution, codec, frame-rate, file size).

    Thanks,
     
  16. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    I see the ExoPlayer 2.9.0 is going to be released "soon" and it includes better performance for videos with a high frame rate....We'll be sure to include this as soon as it's available. I don't know if it will help you, but thought you might be interested to know.

    https://github.com/google/ExoPlayer/blob/dev-v2/RELEASENOTES.md

    Thanks,
     
  17. AndrewRH

    AndrewRH

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

    AVPro Video version 1.9.1 has just been released!

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

    Changes include:

    macOS and iOS
    • Fixed bug where video would always auto-play (only iOS < 10.0 and macOS < 10.12)
    • Fixed bug where texture properties (wrap, filter etc) weren’t being set
    WebGL
    • Fixed regression introduced in 1.9.0 which prevents videos from loading
    • Fixed support for 3rd party decoder libraries
    • Added support for “blob:” URL scheme
    General
    • Resampler now honours texture properties set in MediaPlayer
    • Added position bar to PlaylistMediaPlayer editor
    Windows Desktop
    • Fixed focus, volume and mute on videos using FB 360 Audio
    • Fixed some issues with switching between instances of videos using system audio and FB 360 Audio
    • Fixed a bug where audio sample rate and channel count were swapped around
    Please report any issues here on the forum, or to our customer support email.

    Thanks,
     
  18. Mulm

    Mulm

    Joined:
    Nov 15, 2012
    Posts:
    3
    Hi, I'm using windows 8 and I get the "loading failed" error on every livestream I try to play. They work fine in vlc and I have tried several, same streams work on avpro on windows 10. Any idea what I might need on the windows 8 machine for this to work properly? Thanks :)
     
  19. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    AVPro Video doesn't have native support for HLS/Dash streaming on Windows 8 - it currently requires Windows 10 because we use the codecs natively supported by the operating system. For Windows desktop operating systems older than Windows 10, there is only currently one method you can use with AVPro Video to support adaptive streaming: Install "Lav Filters" (from its github releases page), and set the "Video Api" field to "DirectShow" (in MediaPlayer > Platform Specific > VideoAPI).

    thanks,
     
    Mulm likes this.
  20. gasmedley

    gasmedley

    Joined:
    Sep 10, 2018
    Posts:
    4
    Hi, I'm trying to get a hls stream working on ios and osx using multiple audio streams. AVPro is only detecting one stream on OSX but it detects two on windows. Here's the format of my m3u8:

    Code (CSharp):
    1. #EXTM3U
    2. #EXT-X-VERSION:7
    3. #EXT-X-INDEPENDENT-SEGMENTS
    4. #EXT-X-STREAM-INF:BANDWIDTH=1369902,AVERAGE-BANDWIDTH=1276969,CODECS="avc1.77.30,mp4a.40.2",RESOLUTION=320x180,FRAME-RATE=29.970
    5. video/out.m3u8
    6. #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="stereo",LANGUAGE="en",NAME="pitchdown",DEFAULT=NO,AUTOSELECT=YES,URI="audio/out.m3u8"
     
  21. silverfire330

    silverfire330

    Joined:
    Jul 17, 2015
    Posts:
    7
    Is there a way to easily listen for texture changes within an HLS stream? On windows it gives it a debug message but that's it.
     
  22. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    Yes there is an event "ResolutionChanged" that is triggered - you can listen for this event from the MediaPlayer
     
  23. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    We'll investigate this and get back to you...thanks,
     
  24. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    Hi,

    Windows is probably just being very leniant. I suspect that there is something not quite right with the manifest. You may want to run it through Apple's streaming media validator tool:
    https://developer.apple.com/library/archive/technotes/tn2235/_index.html

    Apple in general are very picky about the structure of the HLS manifest, which is why they have tools like the above validator. The validator should tell you about any problems with your manifest.

    Just off the top of my head, the issue could perhaps be that the #EXT-X-STREAM-INF requires AUDIO=“stereo”..

    I hope that helps,
     
  25. gasmedley

    gasmedley

    Joined:
    Sep 10, 2018
    Posts:
    4
    Hi, here's my next run at generating an m3u8 using ffmpeg. Bear in mind this is as ffmpeg generated it. GetAudioTrackCount is still returning 1. The only issues that the validator is giving me is that there's a bitrate mismatch in rendition 0.

    edit: i manually added the language and frame-rate tags as the osx hls spec seems to require them. This didn't make it work either.

    Code (CSharp):
    1. #EXTM3U
    2. #EXTM3U
    3. #EXT-X-VERSION:3
    4. #EXT-X-MEDIA:TYPE=AUDIO,LANGUAGE="eng",GROUP-ID="group_default",NAME="audio_0",DEFAULT=YES,URI="bbb1/bbb.m3u8"
    5. #EXT-X-MEDIA:TYPE=AUDIO,LANGUAGE="eng",GROUP-ID="group_default",NAME="audio_0",DEFAULT=YES,URI="bbb2/bbb.m3u8"
    6. #EXT-X-STREAM-INF:BANDWIDTH=1297000,RESOLUTION=320x180,CODECS="avc1.640014,mp4a.40.2",AUDIO="group_default"
    7. bbb0/bbb.m3u8
    8.  
    9. #EXT-X-STREAM-INF:BANDWIDTH=154000,FRAME-RATE="30",CODECS="mp4a.40.2",AUDIO="group_default"
    10. bbb1/bbb.m3u8
    11.  
    12. #EXT-X-STREAM-INF:BANDWIDTH=154000,FRAME-RATE="30",CODECS="mp4a.40.2",AUDIO="group_default"
    13. bbb2/bbb.m3u8
    14.  
     
    Last edited: Sep 13, 2018
  26. gasmedley

    gasmedley

    Joined:
    Sep 10, 2018
    Posts:
    4
    I got it to work! Still trying to discern why, but i'll post the successful version when i have it.
     
    AndrewRH likes this.
  27. phileday

    phileday

    Joined:
    Feb 8, 2014
    Posts:
    85
    Hi

    I have a general question regarding AVPro, DLNA and playing back from network locations from an Android device.

    Basically is this possible? I make a player called Whirligig and I'm currently making a version for the Oculus Go/GearVR and one of the things requested and I think should be in the release is this feature. Other players such as Skybox have it but I don't know really where to begin. I guess I need to find a way to get Unity3D to list the available locations and then direct AVPro to playback from those locations.

    Any advice or help would be very much appreciated. Even if it's just pointing me at the write url for help. I've search away on the internet and keep coming up with network gaming which is making it hard to find what I'm looking for. I'd also be interested if there were freelancers out there that were interested to help.

    All the best and great to see AVPro getting better and better.

    Phil
     
    neurocat likes this.
  28. gasmedley

    gasmedley

    Joined:
    Sep 10, 2018
    Posts:
    4
    Here it is. The problem was that the stream names were the same. Everything else appears to be peanuts.

    Code (CSharp):
    1. #EXTM3U
    2. #EXT-X-VERSION:3
    3. #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group_default",NAME="audio_0",DEFAULT=YES,URI="bbb1/bbb.m3u8"
    4. #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group_default",NAME="audio_1",DEFAULT=YES,URI="bbb2/bbb.m3u8"
    5. #EXT-X-STREAM-INF:BANDWIDTH=946000,RESOLUTION=320x180,CODECS="avc1.640014,mp4a.40.2",AUDIO="group_default"
    6. bbb0/bbb.m3u8
    7.  
    8. #EXT-X-STREAM-INF:BANDWIDTH=154000,CODECS="mp4a.40.2",AUDIO="group_default"
    9. bbb1/bbb.m3u8
    10.  
    11. #EXT-X-STREAM-INF:BANDWIDTH=154000,CODECS="mp4a.40.2",AUDIO="group_default"
    12. bbb2/bbb.m3u8
    13.  
    14.  
     
  29. Monarc

    Monarc

    Joined:
    Jun 20, 2016
    Posts:
    7
    Hi I updated avpro to latest version and I got following error message on android.
    It was good on old version of avpro.(I forgot what the version number was)


    E/Unity ( 2684): Unable to find AVProLocal
    W/dalvikvm( 2684): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/RenderHeads/AVProVideo/AVProMobileVideo;
    E/Unity ( 2684): AndroidJavaException: java.lang.ClassNotFoundException: com.RenderHeads.AVProVideo.AVProMobileVideo
    E/Unity ( 2684): java.lang.ClassNotFoundException: com.RenderHeads.AVProVideo.AVProMobileVideo
    E/Unity ( 2684): at java.lang.Class.classForName(Native Method)
    E/Unity ( 2684): at java.lang.Class.forName(Class.java:251)
    E/Unity ( 2684): at java.lang.Class.forName(Class.java:216)
    E/Unity ( 2684): at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
    E/Unity ( 2684): at com.unity3d.player.UnityPlayer.c(Unknown Source)
    E/Unity ( 2684): at com.unity3d.player.UnityPlayer$c$1.handleMessage(Unknown Source)
    E/Unity ( 2684): at android.os.Handler.dispatchMessage(Handler.java:98)
    E/Unity ( 2684): at android.os.Looper.loop(Looper.java:136)
    E/Unity ( 2684): at com.unity3d.player.UnityPlayer$c.run(Unknown Source)
    E/Unity ( 2684): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load AVProLocal from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.glu.celebslots-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.glu.celebslots-1, /system/lib]]]: findLibrary returned null
    E/Unity ( 2684): at java.lang.Runtime.loadLibrary(Runtime.java:358)
    E/Unity ( 2684): at java.lang.System.loadLibrary(System.j
    E/Unity ( 2684): NullReferenceException: Object reference not set to an instance of an object
    E/Unity ( 2684): at RenderHeads.Media.AVProVideo.AndroidMediaPlayer..ctor (Boolean useFastOesPath, Boolean showPosterFrame, VideoApi api, Boolean enable360Audio, Audio360ChannelMode channelMode, Boolean preferSoftware) [0x00000] in <filename unknown>:0
    E/Unity ( 2684): at RenderHeads.Media.AVProVideo.MediaPlayer.CreatePlatformMediaPlayer () [0x00000] in <filename unknown>:0
    E/Unity ( 2684): at RenderHeads.Media.AVProVideo.MediaPlayer.Initialise () [0x00000] in <filename unknown>:0
    E/Unity ( 2684): at RenderHeads.Media.AVProVideo.MediaPlayer.Start () [0x00000] in <filename unknown>:0
    E/Unity ( 2684):
    E/Unity ( 2684): (Filename: Line: -1)
    E/Unity ( 2684):


    The unity is 5.6.5p4 and libAVProLocal is included. What should I do to fix this?
    I removed arm64-v8a because unity5 doesn't support that.

    Thanks in advance.
    upload_2018-9-17_14-6-38.png
    upload_2018-9-17_14-8-12.png
     
  30. Barsik_The_CaT

    Barsik_The_CaT

    Joined:
    Sep 23, 2017
    Posts:
    5
    Hello, I am unable to play my video using 360 sphere example.
    The video comes from Vuze camera and has the following specs:
    H.264 encoded, 4096x4096 dimensions, 4K resolution (each eye), top-bottom layout, mp4 format, 30 fps, bitrate 120/80 mb/sec.
    When I use Direct Show everything is black and no audio.
    When I use Media Foundation everything is green, but the audio is working.
    I get the same effect when playing it in Windows Movies app.
    The video works fine in 3rd party players.
    The video works when used in Unity's video player, but with severe stuttering.
     
  31. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    Hi Phil!

    DLNA isn't something we're ever investigated. I guess you need some code that will enumerate the DLNA location and return the URLS for the media files. I don't know whether those URLs are something that the player will support as I'm not familiar with what form they will be in.

    We can certainly add this to the list of things to investigate, but if you can give us more information and we can see that it isn't too much work to add, then this will greatly improve the chance of this feature being added quickly.

    Thanks,
     
  32. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    That's strange - the plugins seem to have lost their platform and architecture metdata. All of the files in the /Plugins/Android folder should be set to Android platform only. Then inside /Plugins/Android/Libs/ the files should have the correct architecture set, based on the folder. And you are correct to delete the arm64 folder.

    That should solve it..Otherwise try deleting the AVPro Plugin files completely, and importing the unitypackage again. Make sure your project is set to use .meta files in the Editor settings. Let me know how it goes.

    Thanks,
     
  33. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    Could you send us a small 4K Vuze video file to test with? http://www.renderheads.com/contact/
    It is unlikely that DirectShow would be able to support it natively since the resolution is so high and the default DirectShow codecs are very old. You could try installing "LAV Filters" on your system and then it should be able to support it, but of course installing extra codecs isn't ideal.
    On Media Foundation I'm not sure why it is green. Does it make a difference if you disable hardware decoding? What GPU do you have?

    Thanks,
     
  34. Barsik_The_CaT

    Barsik_The_CaT

    Joined:
    Sep 23, 2017
    Posts:
    5
    Hardware decoding was indeed a problem - turns out video drivers on my workstation were not updated since it was assembled, updating fixed that issue. Thanks for pointing out!
     
    AndrewRH likes this.
  35. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    578
    Like others, I need to control video using Unity's Timeline. I really wish Renderheads could see the usefulness in this feature.

    Meanwhile, I've had to implement a "bridge". Three scripts are pasted in below. Please share improvements.

    TODO. I can't find a way to get an event when a clip is exited while the timeline is not playing. This causes the last played frame will hang if you scrub to a place outside clips.

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Playables;
    3.  
    4. public class AVProVideoClipAsset : PlayableAsset
    5. {
    6.    public string filePath;
    7.    public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
    8.    {
    9.        var playable = ScriptPlayable<AVProVideoControlBehaviour>.Create( graph );
    10.        var playerControlBehaviour = playable.GetBehaviour();
    11.        playerControlBehaviour.filePath = filePath;
    12.        return playable;
    13.    }
    14. }
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Playables;
    3. using RenderHeads.Media.AVProVideo;
    4.  
    5. public class AVProVideoControlBehaviour : PlayableBehaviour
    6. {
    7.     public string filePath;
    8.     MediaPlayer _player;
    9.  
    10.  
    11.     public override void ProcessFrame( Playable playable, FrameData info, object playerData )
    12.     {
    13.         if( !Application.isPlaying ) return;
    14.  
    15.         // Get the player.
    16.         if( !_player ) _player = playerData as MediaPlayer;
    17.         if( !_player ) return;
    18.  
    19.         // Open clip.
    20.         if( _player.m_VideoPath != filePath || !_player.VideoOpened ){
    21.             _player.OpenVideoFromFile( MediaPlayer.FileLocation.RelativeToProjectFolder, filePath, true );
    22.             _player.m_AutoStart = false;
    23.         }
    24.      
    25.         // Only if opened ...
    26.         if( !_player.VideoOpened ) return;
    27.  
    28.         // Check if timeline is playing and get clip time.
    29.         bool isTimelinePlaying = playable.GetGraph().IsPlaying();
    30.         float clipTimeMs = (float) playable.GetTime() * 1000;
    31.         if( isTimelinePlaying ){
    32.             // Play.
    33.             if( !_player.Control.IsPlaying() ){
    34.                 _player.Control.Seek( clipTimeMs );
    35.                 _player.Control.Play();
    36.             }
    37.         } else {
    38.             // Scrub.
    39.             _player.Control.Seek( clipTimeMs );
    40.             if( _player.Control.IsPlaying() ) _player.Control.Pause();
    41.         }
    42.     }
    43.  
    44.  
    45.     public override void OnBehaviourPause( Playable playable, FrameData info )
    46.     {
    47.         if( !Application.isPlaying || !_player ) return;
    48.  
    49.         bool isTimelinePlaying = playable.GetGraph().IsPlaying();
    50.         if( isTimelinePlaying ){
    51.             // Pause is also called while timeline is still playing AND this clip is exited. In that case we stop playback and close the video.
    52.             _player.Control.Stop();
    53.             _player.CloseVideo();
    54.         } else {
    55.             _player.Control.Pause();
    56.         }
    57.     }
    58. }
    Code (CSharp):
    1. using UnityEngine.Timeline;
    2. using RenderHeads.Media.AVProVideo;
    3.  
    4. [TrackClipType(typeof(AVProVideoClipAsset))]
    5. [TrackBindingType(typeof(MediaPlayer))]
    6. public class AVProVideoPlayerTrack : TrackAsset {
    7.  
    8. }
     
    Last edited: Sep 19, 2018
    AndrewRH likes this.
  36. MESHED-space-GmbH

    MESHED-space-GmbH

    Joined:
    Nov 11, 2015
    Posts:
    22
    Hi, we try to use your product for Videos in WebGL. It works fine on Browsers on Android mobiles, but there will no Video loaded on IPads or IPhones - is there a solution or is it only possible via Apps on IPad/IPhones ?

    Thanks,
    Ulf Marsche
    Meshed Space Team
     
  37. davidbozo

    davidbozo

    Joined:
    Sep 20, 2018
    Posts:
    2
    Dear AndrewRH,

    I would like to create a stream for your production from a Go Pro Hero 5 Black. I want to consume and display the stream on Android platform. I have an Elgato Cam Link capture card which creates a DirectShow source as far as i know. I have lack of experience with streams, encoding etc. So can you please give me some detailed information, which program should i use to create the right stream?

    Thanks,
    David Bozo
     
  38. phileday

    phileday

    Joined:
    Feb 8, 2014
    Posts:
    85
    To be honest I think what I need is a way to list the network locations accessible through the wifi so they can be browsed, then, I'm assuming that I'll be able to load the video using the distinct network path in AVpro. This works on the PC, although I haven't found a way to list network locations but I can just copy and paste the location, \\meda\\videos\temp.mp4 for example. I'm hoping that is is possible on Android but I don't know how to retrieve the locations to try it.

    If you have any ideas about that that would be really useful. The DLNA seems to be related to that I think, or at least the network locations is what people want whether it is DLNA or not.
     
  39. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    Thanks for this!! We will look at Timeline integration soon :) No doubt your contribution has given this feature a huge boost! Thanks,
     
  40. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    Is this on Safari? I know Safari has some issues playing videos as it default to not play videos automatically. We have some notes in our documentation about how to address this. Or is there an actual error log (view in developer mode console)?

    Thanks,
     
  41. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    If you don't want to do this in Unity, then something like OBS can be used to recieve the camera stream and then rebroadcast to a streaming service (eg WowZA) to create a HLS stream which can be played on Android...If you want to use Unity for everything, then I'm not sure if there any options to create a live stream...
     
  42. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    Will have to add this to our list of things to test....
     
  43. Barsik_The_CaT

    Barsik_The_CaT

    Joined:
    Sep 23, 2017
    Posts:
    5
    Hello. I faced a problem - my stereo video becomes not stereo when played in AVPro. Not just that, but when I specify stereo packing as Top Bottom it distorts video. Playing video in your 360 sphere exmaple, multipass enabled, apply to mesh disabled, 4096x4096, H264 encoded, top bottom packing, mp4 format
     
  44. davidbozo

    davidbozo

    Joined:
    Sep 20, 2018
    Posts:
    2
    Should i tweak some settings somewhere? Because it works on Windows but on Android i get this error:
    (The stream resolution is 1280x720.)
    Code (CSharp):
    1. 09-21 08:05:43.037 19142 19178 I Unity   : [AVProVideo] Initialising AVPro Video (script v1.9.1 plugin v1.9.0t) on Adreno (TM) 330/OpenGL ES 3.0 V@140.0 AU@ (GIT@I741a3d36ca) (MT False) on Android
    2.  
    3. 09-21 08:05:43.037 19142 19178 I Unity   :
    4.  
    5. 09-21 08:05:43.037 19142 19178 I Unity   : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
    6.  
    7. 09-21 08:05:43.037 19142 19178 I Unity   :
    8.  
    9. 09-21 08:05:43.046 19142 19178 I Unity   : [AVProVideo] Opening https://05f599.entrypoint.cloud.wowza.com/app-b2cb/ngrp:1ed0634e_all/playlist.m3u8  (offset 0)
    10.  
    11. 09-21 08:05:43.046 19142 19178 I Unity   :
    12.  
    13. 09-21 08:05:43.046 19142 19178 I Unity   : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
    14.  
    15. 09-21 08:05:43.046 19142 19178 I Unity   :
    16.  
    17. 09-21 08:05:43.060 19142 19142 I System.out: AVProVideo video state: buffering
    18.  
    19. 09-21 08:05:43.061 19142 19142 I System.out: AVProVideo buffer preparing
    20.  
    21. 09-21 08:05:43.367 19142 19142 E AVProVideo: EventLogger: internalError [0.50, loadError]
    22.  
    23. 09-21 08:05:43.367 19142 19142 E AVProVideo: EventLogger: com.google.android.exoplayer2.source.UnrecognizedInputFormatException: None of the available extractors (MatroskaExtractor, FragmentedMp4Extractor, Mp4Extractor, Mp3Extractor, AdtsExtractor, Ac3Extractor, TsExtractor, FlvExtractor, OggExtractor, PsExtractor, WavExtractor, AmrExtractor) could read the stream.
    24.  
    25. 09-21 08:05:43.367 19142 19142 E AVProVideo: EventLogger:     at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractorHolder.selectExtractor(ExtractorMediaPeriod.java:927)
    26.  
    27. 09-21 08:05:43.367 19142 19142 E AVProVideo: EventLogger:     at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:849)
    28.  
    29. 09-21 08:05:43.367 19142 19142 E AVProVideo: EventLogger:     at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:320)
    30.  
    31. 09-21 08:05:43.367 19142 19142 E AVProVideo: EventLogger:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
    32.  
    33. 09-21 08:05:43.367 19142 19142 E AVProVideo: EventLogger:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
    34.  
    35. 09-21 08:05:43.367 19142 19142 E AVProVideo: EventLogger:     at java.lang.Thread.run(Thread.java:818)
    36.  
    37. 09-21 08:05:43.373 19142 19419 E ExoPlayerImplInternal: Source error.
    38.  
    39. 09-21 08:05:43.373 19142 19419 E ExoPlayerImplInternal: com.google.android.exoplayer2.source.UnrecognizedInputFormatException: None of the available extractors (MatroskaExtractor, FragmentedMp4Extractor, Mp4Extractor, Mp3Extractor, AdtsExtractor, Ac3Extractor, TsExtractor, FlvExtractor, OggExtractor, PsExtractor, WavExtractor, AmrExtractor) could read the stream.
    40.  
    41. 09-21 08:05:43.373 19142 19419 E ExoPlayerImplInternal:     at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractorHolder.selectExtractor(ExtractorMediaPeriod.java:927)
    42.  
    43. 09-21 08:05:43.373 19142 19419 E ExoPlayerImplInternal:     at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:849)
    44.  
    45. 09-21 08:05:43.373 19142 19419 E ExoPlayerImplInternal:     at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:320)
    46.  
    47. 09-21 08:05:43.373 19142 19419 E ExoPlayerImplInternal:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
    48.  
    49. 09-21 08:05:43.373 19142 19419 E ExoPlayerImplInternal:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
    50.  
    51. 09-21 08:05:43.373 19142 19419 E ExoPlayerImplInternal:     at java.lang.Thread.run(Thread.java:818)
    52.  
    53. 09-21 08:05:43.375 19142 19142 I System.out: AVProVideo error null
    54.  
    55. 09-21 08:05:43.375 19142 19142 I System.out: AVProVideo video state: idle
    56.  
    57. 09-21 08:05:43.387 19142 19178 E Unity   : [AVProVideo] Error: Loading failed.  File not found, codec not supported, video resolution too high or insufficient system resources.
    58.  
    59. 09-21 08:05:43.387 19142 19178 E Unity   :
    60.  
    61. 09-21 08:05:43.387 19142 19178 E Unity   : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
    62.  
    63. 09-21 08:05:43.387 19142 19178 E Unity   :
     
  45. NS24

    NS24

    Joined:
    Feb 21, 2018
    Posts:
    15
    Just to let you know I'm seeing this issue as well in the Unity Editor on Windows. However when I test on GearVR stereo video seems to play ok.

    I'm also finding that when I set Stereo Packing to Top/Bottom, mono videos seem to play with their mapping incorrectly on both GearVR and in the Unity Editor.
     
  46. shoo

    shoo

    Joined:
    Nov 19, 2012
    Posts:
    61
    Hello!
    Does AVPro MediaPlayer has any static method to get video duration?
    I mean, I dont need to load/play files, I just wnt to collect its data
     
  47. NS24

    NS24

    Joined:
    Feb 21, 2018
    Posts:
    15
    AndrewRH likes this.
  48. shoo

    shoo

    Joined:
    Nov 19, 2012
    Posts:
    61
    It isn't static metod, I need to open media to use this method. Also I need callback for event type MetaDataReady, so in this case I need some wrapper around mediaplayer, and also I need a gameobject to put media player on it.

    Or maybe I just cant undertand how to use this properly, but i need something like
    MediaPlayer.Info.GetDurationMs(string filename, UnityAction<float> callback)
     
  49. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    No, there is currently no API to just query the media properties of a file without opening it for playback. So you could use the MediaPlayer component to open the file, and then when the metadata available even is fired, you could read the duration and then close it. Otherwise you would have to implement your own code to read the relavent ATOM data from the file directly.

    Thanks,
     
  50. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    Hmm, that's strange. It sounds like the m3u8 manifest has some problem....
     
unityunity