Search Unity

[Released] AVPro Video - complete video playback solution

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

  1. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    719
    hi,
    thanks for replay.
    i tried with beta but unity native video not play propyl with HTTP. i submitted bug but thanks for replay.
     
  2. nbaris

    nbaris

    Joined:
    Jan 13, 2015
    Posts:
    16
    I have a 30 second video. I want to play the first 20 seconds, and then loop the remaining 10 seconds.

    I was thinking I'd add a keyframe at 20 seconds for the video. Then in the Update, if GetCurrentTimeMs = 30 + x for positive x, I do Seek (20.0f + x). But to do this seamlessly and reliably, I guess I'd need to be able to do the GetCurrentTimeMs () and possible seek before that frame is displayed.
    Is this possible / a sensible way to do it?

    I could instead break the video in 2, play them in order and just loop the second one, but it seemed this might not be as seamless in older devices passing from the first video to the second.


    Note: From what I've tested so far, this seems like an amazing plugin, thanks!
     
  3. Yukinobu-Mine

    Yukinobu-Mine

    Joined:
    Sep 9, 2015
    Posts:
    1
    Hi
    I'm trying AVPro Video for playback HTTP Live Streaming and I have a question.

    Can I specify HTTP cookie to AVPro MediaPlayer for authentication?
    (Both Android MediaPlayer and iOS AVPlayer can specify HTTP cookie)
     
  4. moisoiuqubiz

    moisoiuqubiz

    Joined:
    Dec 6, 2016
    Posts:
    6
    Hello did somoene manage to use AVPRO for streaming ? I'm using UWP and I had a Stream variable, how can I add it to play it on AVPRO ?

    I have the Mixed Reality Capture video with holograms but is on a stream and I want to show it on a Quad. How can I achieve this with AVPRO ?

    I'm using Hololens device
     
  5. celoron

    celoron

    Joined:
    Oct 7, 2015
    Posts:
    1
    Hi, I recently tested trial plugin on hololens and it worked pretty well so I decided to buy. I only need for hololens so I bought only windows.

    Everything was working on trial plugin but when i downloaded paid plugin from asset store video playback stopped working. (i removed plugins folder while unity closed and imported plugin from asset store just like in the manual suggested)

    My problem is;
    I can hear sound coming from the video but the video is just a white screen.

    I tested;
    - Change DLLs to trial plugin DLLs, and worked but ofc with watermarks,
    - With different video codecs and resolutions
    - Created empty project and just tested video playback

    MediaPlayerEvent results no error code;
    [AVProVideo] Opening C:/Data/Users/DefaultAccount/AppData/Local/DevelopmentFiles/ProjectVS.Release_x86.celoron/Data/StreamingAssets\video.mp4 (offset 0)
    [AVProVideo] Using playback path: MF-MediaEngine-Hardware (0x0@0.00)
    [AVProVideo] Using playback path: MF-MediaEngine-Hardware (0x0@0.00)
    Media player event: MetaDataReady errorcode:None
    Media player event: ReadyToPlay errorcode:None
    Media player event: Started errorcode:None
    Media player event: FirstFrameReady errorcode:None

    I was using OpenVideoFromFile with trial plugin, but with paid plugin doesn't work at all.

    So i decided to put all videos in different gameobject and just enable the video i need. And very interesting S*** happened. Now it works randomly. This is mind boggling. I have 5 video in the scene (only playing one at a time) and sometimes 2 of them works, sometimes 3 of them works and sometimes miracle happens and all of them works. But i am sure you will accept the fact that I will have a very bad time explaining this to people.

    I am using Unity 5.5.0f3 on a Windows 10 64-bit
    I emailed unitysupport@renderheads.com 2 days ago and I didn't get a response yet.

    Any help will be appreciated.
     
  6. moisoiuqubiz

    moisoiuqubiz

    Joined:
    Dec 6, 2016
    Posts:
    6
    Celeron, how did you make it work with hololens on free version ?

    I coudn't manage to make it play, even if I set the path to it, it doesn't play it was unknown path
     
  7. DavidChuang

    DavidChuang

    Joined:
    Nov 28, 2016
    Posts:
    3
    I'm follow your way to search my mp4 video metadata,but no found the data about the stereo switch.
    I used ExifToolgui to get video metadata.

    https://drive.google.com/file/d/0By8vr9hvpwAESWk3NU56MmU3WU0/view?usp=sharing

    This download is my test video.
    Can you help me which one metadata I should remove?
    thanks.
     
  8. wisebits

    wisebits

    Joined:
    Nov 16, 2016
    Posts:
    4
    Your docs says about UpdateStereoMaterial:
    "This script isn't needed for Unity 5.4 and above."
    What is not true or there just no word how to stay without it and have a stereo effect.

    And the question:
    how to turn off/on (toggle) between stereo and mono rendering?

    AVPro Video 1.5.12
    Unity 5.6.0b3
    Win 10 x64
     
    Last edited: Dec 28, 2016
  9. lumeneo

    lumeneo

    Joined:
    Mar 3, 2014
    Posts:
    50
    GASP!!!! :eek:
     
  10. Smagacz

    Smagacz

    Joined:
    Feb 10, 2016
    Posts:
    23
    Hi, I would like to make app that displays 5 different videos (fullHd). Each video weighs about 1Gb.
    Camera is pointing at one of those videos, so one video is running and anotcher are paused, then I want to click an arrow to change video . I use webgl. To Display video i used panel and "Display UGUI" script on it.The problem is that, video not running smoothly. One video works well but 5 not (In editor 5 videos works well too) . Should i use any avpro or unity special setting ? Any ideas?
     
    Last edited: Jan 1, 2017
  11. ITPeopleNani

    ITPeopleNani

    Joined:
    Sep 30, 2016
    Posts:
    1
    I have the same problem here.
     
  12. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,001
    Hi @AndrewRH,
    I have Full AVPro but what if i want only macOS version? If i send you my order id for full, can i get vouchers for seperate editions? Thanks
     
  13. markachten88

    markachten88

    Joined:
    Apr 24, 2015
    Posts:
    31
    He @AndrewRH . All the best for the new year, by the way!

    We're running Safari 9.1.2 (11601.7.7) on El Capitan (10.11.6).
     
  14. AndrewRH

    AndrewRH

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

    Happy New Year! RenderHeads is back in the office from Friday 6th January. Will reply to all of the questions on this thread then. Thanks,
     
  15. mkneib

    mkneib

    Joined:
    Aug 3, 2016
    Posts:
    6
    Same problem here, except i have never tried the demo plugin. 10 Videos. Sometimes 7 are visible, sometime 2, sometimes none. At first i thought i found a sweet spot with 4 videos, but after a restart, nothing was visible, with the next restart, everything was visible. Totally random.

    I have tried with multiple MediaPlayer instances, i have tried with a single instance (i need only one video at a time). I have tried Apply To Mesh, i have tried Apply To Material, i have tried UGUi, i have tried multiple shaders.

    Sorry, no help, but you are not alone.
     
    Last edited: Jan 4, 2017
  16. v3_matt

    v3_matt

    Joined:
    Aug 10, 2015
    Posts:
    8
    Andrew / RenderHeads: Found a bug that you may want to patch up.

    Was trying to set volume level / mute volume via script. Initially hit MediaPlayer.m_Volume, but these changes were getting overwritten by MediaPlayerEditor at media.m_Volume = media.Control.GetVolume(). Same issue with MediaPlayer.m_Muted.

    I read the docs, and found I was supposed to use MediaPlayer.Control.SetVolume, but this can't be called during Awake due to script execution order. Solution was very roundabout:

    Code (CSharp):
    1. if (mediaPlayer.Control != null)
    2. {
    3.     mediaPlayer.Control.SetVolume(v);
    4.     // or mediaPlayer.Control.MuteAudio(b);
    5. }
    6. else
    7. {
    8.     mediaPlayer.m_Volume = v;
    9.     // or mediaPlayer.m_Muted = b;
    10. }
    In general, it's a little weird to have a member like m_Volume be publicly accessible, if it's not intended to be in your API. Consider finding a way to revise such that m_Volume is a private serialized field.
     
  17. pao_olea

    pao_olea

    Joined:
    Dec 31, 2015
    Posts:
    16
    I created an application for Android and iOS, in Android works fine, but when I exported to iOS, when I tried to validate in Xcode, this give me an error:

    _UnityRegisterRendererPluginV5, referenced from:
    _AVPPluginRegister in libAProVideoiOS.a (AVProPlugin.o)

    Please help with this, thanks.
     
  18. The_Arrival

    The_Arrival

    Joined:
    Dec 3, 2014
    Posts:
    79
    Hello Renderheads,

    Unity 5.6
    AVPro 1.5.10t
    Editor runs on MacOS 10.12.2

    Video:
    - Resolution: 4096*2048
    - Codec: H264 MPEG-4 AVC
    - FrameRate 30

    i´m currently checking out the free trial considering to buy the pro versions:

    - Whats exactly the difference between the enterprise and the pro version. I found the extra agreement from the enterprise license, but not the pro license to actually compare. Is the pro version limited to one seat, or even to a certain amounts of projects?
    - I´m building a 360 degree video app, with stereoscopic video and spartial audio for android and iOS mobiles for Google Cardboard. since i need spartial audio (so using google SDK Soundfield) i will need to sync the video with a seperate audio track. Will AVPro be able to render the named video on mobile devices in a reasonable framerate (60+) in stereoscopic?

    EDIT: Bump! Still would need some answers :)
     
    Last edited: Jan 9, 2017
  19. praagmatic

    praagmatic

    Joined:
    Mar 23, 2014
    Posts:
    5
    Thanks for the advice, in the end I got the functionality it by doing a simple -if frames > min frames then frames = min frames- type of work around. Using a similar method I can set min/max frames.

    I have another issue trying to use AVPro with Hololens
    AVpro works fine but when I run it in the hololens emulator I get

    "[AVProVideo] Using playback path: Unknown (0x0@0.00)"

    And on the hololens hardware it just crashes. I'm assuming its because AVIPro cannot find the video file(?). I have tried adding the file to various locations in the build folders (I am using 'Relative to Data Folder' option for the file path) but to no avail.

    Is there a recommended file path option to use with the Hololens?
     
  20. moisoiuqubiz

    moisoiuqubiz

    Joined:
    Dec 6, 2016
    Posts:
    6
    You cna try and use the class -> ApplicationData.Current.LocalFolder.Path I think
     
  21. jjennings1990

    jjennings1990

    Joined:
    Oct 25, 2012
    Posts:
    108
    Hello I wanted to know is there anyway to play a Packaged .MPR video from an asset bundle ? If so what would be the best way to go about this ? Would I set the source Path to be Relative to Data folder and then possibly insert the file path to where the videos are located ? I have tried looking at the documentation and haven't found any examples of playing a video from the Asset bundle itself. Thank you !
     
  22. NathanRH

    NathanRH

    Joined:
    Oct 24, 2012
    Posts:
    94
    Hi nbaris,

    What you're trying to do isn't easy! Your idea of adding a key-frame at the exact frame you want to jump to is a good one. You might need to make the first few frames of the loop all key-frames, and even disable B-frames during the encoding to give the the best chance of a fast seek. Doing this all seamlessly is tricky.. I'm afraid I don't really have a solution for this that is ready to roll out. To get the best results you probably would need to buffer the Texture that is updated by the plugin and handle the display of it yourself, storing say the last 8 frames, this way you could perhaps hide any hickups that arise from seeking.

    You could also make your video longer and manually loop the sequence 10 times. At least then it will "loop" smoothly most of the time and perhaps have a slight jump every 10 loops...

    Thanks,
     
  23. NathanRH

    NathanRH

    Joined:
    Oct 24, 2012
    Posts:
    94
    No it's not possible to specify an HTTP cookie. This is a good idea though. I will see if we can add this to the next version. Thanks,
     
  24. NathanRH

    NathanRH

    Joined:
    Oct 24, 2012
    Posts:
    94
    AVPro Video does have support for playing back videos on Hololens. I'm not sure what a Stream variable is though .... is that something Hololens specific? Our plugin can play back video files and streams (such as HLS). We're just using the Hololens simulator as we don't have the actual hardware.
    Thanks,
     
  25. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Hi,
    I'm very interested to help you solve this problem. I understand that you have 2 problems:

    1) The full plugin doesn't work at all, but the trial version does
    2) The trial plugin has trouble playing back when you have multiple videos instantiated

    I hope I understand you right, please correct me if it's wrong.

    The first issue is a mystery. I suspect we made a mistake when creating the full plugin. If you're still having trouble please can I email you a new build to test of the plugin?

    I would guess that the issue with multiple video playback is caused by there not being enough memory. I think the Hololens device has a very small amount of memory. High resolution video playback can use a lot of memory, so I would check this first. Also the GPU hardware has limited ability to decode multiple videos at once.

    Does it make any difference if you disable the GPU hardware decoding option (in MediaPlayer > Platform Specific > WindowsUWP)?

    Thanks,
     
  26. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Did you try the demo scenes? Those should just play automatically....

    Are you using the AVPro Video version 1.5.12 and Unity 5.5?
    Are you using the real hardware or the latest verision of the Hololens emulator?

    Thanks,
     
  27. moisoiuqubiz

    moisoiuqubiz

    Joined:
    Dec 6, 2016
    Posts:
    6
    Hi @NathanRH thank you for you reply. Regarding to stream I think is something Microsoft related and the reason why I'm saying this is because if I use some component specific for microsoft like MediaCapture and I give the source, the stream is working.

    I've investigated the way you're doing with the Emulator, and for some reason for me the Live Preview doesn't work (I don't know if is working for you guys) but what have I done is adding to the URL this path -> http://localhost/api/holographic/stream/live_low.mp4?holo=true&pv=true&mic=true&loopback=true and it didn't work

    I tried also doing from the backend in C# and gave the path also in backend but still unknown format was shown. I've added the code below, maybe it will help you guys

    @AndrewRH I've tried the demo scenes, and they are working because the file is complete, I'm using the latest AVPro video and Unity 5.5, and i'm using the real hardware and also tried on the emulator

    Hope the code below helps finding a way to play a stream from hololens or somehow to play MediaCapture which is microsoft specific.

    P.S Beside the code that is below there is an working example of streaming

    https://github.com/Microsoft/HoloLensCompanionKit/tree/master/MixedRemoteViewCompositor

    Where they stream from Hololens to application UWP, maybe it will help you about the library they are using

    P.P.S Seems like is not working the Viewer in the emulator because it can't connect to the device (might be some firewall problem)

    Code (CSharp):
    1. public class VideoMRCSettings : IVideoEffectDefinition
    2.     {
    3.         public string ActivatableClassId
    4.         {
    5.             get
    6.             {
    7.                 return "Windows.Media.MixedRealityCapture.MixedRealityCaptureVideoEffect";
    8.             }
    9.         }
    10.  
    11.         public IPropertySet Properties
    12.         {
    13.             get
    14.             {
    15.                 return _Properties;
    16.             }
    17.         }
    18.  
    19.         private IPropertySet _Properties;
    20.         public VideoMRCSettings()
    21.         {
    22.             _Properties = (IPropertySet)new PropertySet();
    23.             _Properties.Add("HologramCompositionEnabled", true);
    24.             _Properties.Add("RecordingIndicatorEnabled", true);
    25.             _Properties.Add("VideoStabilizationEnabled", false);
    26.             _Properties.Add("VideoStabilizationBufferLength", 0);
    27.             _Properties.Add("GlobalOpacityCoefficient", 0.9f);
    28.         }
    29.     }
    Code (CSharp):
    1. MediaCapture captureManager;
    2. async private void InitCamera_Click()
    3.     {
    4.  
    5.         Debug.Log("Init");
    6.         captureManager = new MediaCapture();
    7.  
    8.         MediaCaptureInitializationSettings mcsi = new MediaCaptureInitializationSettings();
    9.         mcsi.StreamingCaptureMode = StreamingCaptureMode.AudioAndVideo;
    10.  
    11.         await captureManager.InitializeAsync();
    12.  
    13.         IVideoEffectDefinition ved = new VideoMRCSettings();
    14.  
    15.         await captureManager.AddVideoEffectAsync(ved, MediaStreamType.VideoRecord);
    16.              
    17.         CaptureVideoStart();
    18.  
    19.         Debug.Log("Done");
    20.     }
    Code (CSharp):
    1. StorageFile file = null;
    2.     async private void CaptureVideoStart()
    3.     {
    4.         Debug.Log("Video");
    5.         MediaEncodingProfile vidFormat = MediaEncodingProfile.CreateMp4(VideoEncodingQuality.Auto);
    6.         //await captureManager.StartRecordToStreamAsync(vidFormat, Stream);    
    7.      
    8.    
    9.  
    10.  
    11.  
    12.  
    13.         ////store file      
    14.         file = await ApplicationData.Current.LocalFolder.CreateFileAsync(
    15.                    "VideoTest.mp4",
    16.                    CreationCollisionOption.GenerateUniqueName);
    17.  
    18.         //startRecord
    19.         await captureManager.StartRecordToStorageFileAsync(vidFormat, file);
    20.  
    21.         PlayVideo();
    22.  
    23.  
    24.         Debug.Log("done");
    25.  
    26.     }
    Code (CSharp):
    1.  private void PlayVideo()
    2.     {
    3.         Debug.Log("File Patg is : " + file.Path);
    4.      
    5.         AvPro_MediaPlayer.m_AutoStart = true;
    6.         AvPro_MediaPlayer.m_AutoOpen = true;
    7.         AvPro_MediaPlayer.m_Loop = true;
    8.         AvPro_MediaPlayer.m_VideoPath = file.Path;
    9.  
    10.         AvPro_applyToMesh._mesh = renderer;
    11.         AvPro_applyToMesh._media = AvPro_MediaPlayer;
    12.  
    13.     }
     
  28. marcojojo

    marcojojo

    Joined:
    Dec 29, 2015
    Posts:
    8
    Hi andrew,

    great plugin :)

    Sadly we can not play a stream(HLS) on the editor. But its working on the iPhone. Any chance it would also work on the editor?

    Thanks
     
  29. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Hi David,
    So I don't think the EXIF tool is any use - it is more for photos I believe.
    I'm not sure exactly what the metadata is - perhaps if you just encode your video using a different tool then it will work. Or rencode it with FFMPEG. We will try to improve this area in the future. Thanks,
     
  30. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Yes this script shouldn't be needed in Unity 5.4 and above, because it has a new shader variable that can be used to determine which eye is rendering.
    To toggle the stereo you would need to change the property of your video in the MediaPlayer > Media Properties panel. Just set the stereo packing mode.
    Thanks,
     
  31. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    I believe we spoke via email. The issue here is the WebGL player - it isn't too smart and it will update videos that are even paused (there's no way for us to detect a texture change as we can for other platforms) so this can lead to a slowdown.
    My recommendation is to disable the MediaPlayer component has it has loaded the video and enable it again when it comes time to play it. This way you should only have a single MediaPlayer enabled and the performance should be greatly improved.
    Thanks,
     
  32. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    This has been fixed in the latest version (1.5.14) which is being released today :) Thanks,
     
  33. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Hmmm, if you already have the full editor then you already have macOS support - I'm not sure why you would want to purcahse the mac-only edition? In any case the per-platform editions is already discounted on the Asset Store.
     
  34. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Sorry about this - Microsoft changed something in the latest SDK update that broke the UWP video player support in AVPro Video. We're releasing a fix for this today (version 1.5.14 of AVPro Video).
    Thanks,
     
  35. AndrewRH

    AndrewRH

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

    Thanks for the advice - you're right. We do intend to hide those variables and fix up the MediaPlayer API - we just have to try to do it without breaking existing apps :) Hopefully we'll patch this up very soon.
     
    v3_matt likes this.
  36. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Which version of Unity are you using? You may have to Update to Unity 5.4.x or above.

    Thanks,
     
  37. AndrewRH

    AndrewRH

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

    The normal (non enterprise) editor is just the standard Unity Asset Store EULA. It is not seat or project limited, but it is site limited. This is the main reason we created the enterprise license, for companies that want to purchase the plugin for multiple sub-companies at multiple sites.

    4096x2048x30 should certainly be doable. In some cases you may need to reduce the resolution to say 3840x1920x30 which we've found is easier for the devices to play.

    I hope this helps you.
     
  38. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Please upgrade to the new version we just released today (v1.5.14) as it has a fix for this Hololens issue. Thanks,
     
    praagmatic likes this.
  39. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Hmm I have no idea what a MP4 video file is :D Even Google doesn't seem to know?

    Yes you can't play a video from the Asset Bundle, but you could include it in the Asset Bundle as a TextAsset. Then when you load the bundle you can load the TextAsset and write it's bytes field to a file on the disk and then play it with AVPro Video. I think that should work just fine.
     
  40. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Thanks. It should work in the editor. Which platform are you using? If you're using a Mac then you probably need to enable permission. Apple are very fussy about apps accessing URLs on macOS, especially if its HTTP and not HTTPS (Apple MUCH prefers this). You can read in the PDF documentation in the Streaming Section about this. Basically I think you either need to use HTTPS url, or you need to edit the Unity Editor's Info.plist file to add the permissions.
     
  41. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Hmm, well we've just submitted a new version (1.5.14) of the plugin to the Asset Store. It fixes an issue with video playback on Hololens. Hopefully this will fix your issue? We just have to wait for it to appear on the Store... Or you can download the new trial version from our website.

    Thanks,
     
  42. AndrewRH

    AndrewRH

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

    AVPro Video version 1.5.14 has just been released!

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

    Changes include:

    General
    • Added subtitle support for external SRT files
    • Added a new demo showing the new subtitle support
    • Improved 03_Demo_VideoControls demo scene to use two MediaPlayers for seamless playlisting
    • Fixed issue where initial playback fields (volume, mute, playback rate, looping) could be reset to incorrect values in certain cases such as such AutoOpen option was disabled
    • Shader improvements such as inlining for performance, sRGB to Linear shader corrections and optimisations
    WSA / UWP / Hololens
    • Fixed bug where video would often not appear, due to audio track being loaded first and reporting metadata loaded. This appears to be a bug/change in the new Anniversary UWP Media Foundation version
    • Plugin DLL file sizes are smaller
    Windows Desktop
    • Plugin DLL file sizes are smaller

    Thanks,
     
    Last edited: Jan 16, 2017
  43. marcojojo

    marcojojo

    Joined:
    Dec 29, 2015
    Posts:
    8
    thanks, i will try it out on the mac. On windows its also not working. What can we do there?
     
  44. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    733
    How is this going @AndrewRH ?
     
  45. piojox11

    piojox11

    Joined:
    Jul 16, 2015
    Posts:
    13
    Hey, I've been playing with the new subtitle feature, but it seems it's impossible to initialize a subtitle in code. EnableSubtitles() doesn't work at all--it checks the old value of the subtitle path (which shouldn't be relevant), then entirely ignores the arguments.

    It doesn't look like a very hard fix--this seems to be a refactor gone wrong from the older movie filename handling code.
     
  46. piojox11

    piojox11

    Joined:
    Jul 16, 2015
    Posts:
    13
    Also, it would be helpful if EnableSubtitles() returned a result or threw an exception. Right now there's no way to check whether it succeeded.
     
  47. SunnyChow

    SunnyChow

    Joined:
    Jun 6, 2013
    Posts:
    338
    i feel the api doesn't work the same in editor and device.

    In my case, after the movie ended, my script will do its own thing and then replay the movie. If the editor just "( MediaPlayer).Play ();" is enough, but it seems not working in iOS or Android
     
  48. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Yes you're right - try the fixes version below:

    Code (CSharp):
    1. public bool EnableSubtitles(FileLocation fileLocation, string filePath)
    2.         {
    3.             bool result = false;
    4.             if (m_Subtitles != null)
    5.             {
    6.                 if (!string.IsNullOrEmpty(filePath))
    7.                 {
    8.                     string fullPath = GetPlatformFilePath(GetPlatform(), ref filePath, ref fileLocation);
    9.  
    10.                     bool checkForFileExist = true;
    11.                     if (fullPath.Contains("://"))
    12.                     {
    13.                         checkForFileExist = false;
    14.                     }
    15. #if (UNITY_ANDROID || (UNITY_5_2 && UNITY_WSA))
    16.                     checkForFileExist = false;
    17. #endif
    18.  
    19.                     if (checkForFileExist && !System.IO.File.Exists(fullPath))
    20.                     {
    21.                         Debug.LogError("[AVProVideo] Subtitle file not found: " + fullPath, this);
    22.                     }
    23.                     else
    24.                     {
    25.                         Helper.LogInfo("Opening subtitles " + fullPath, this);
    26.  
    27.                         _previousSubtitleIndex = -1;
    28.  
    29.                         try
    30.                         {
    31.  
    32.                             if (m_Subtitles.LoadSubtitlesSRT(System.IO.File.ReadAllText(fullPath)))
    33.                             {
    34.                                 m_SubtitleLocation = fileLocation;
    35.                                 m_SubtitlePath = filePath;
    36.                                 m_LoadSubtitles = true;
    37.                                 result = true;
    38.                             }
    39.                         }
    40.                         catch (System.Exception e)
    41.                         {
    42.                             Debug.LogError("[AVProVideo] Failed to load subtitles " + fullPath, this);
    43.                             Debug.LogException(e, this);
    44.                         }
    45.                     }
    46.                 }
    47.                 else
    48.                 {
    49.                     Debug.LogError("[AVProVideo] No subtitle file path specified", this);
    50.                 }
    51.             }
    52.             return result;
    53.         }
    Thanks,
     
  49. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    Hi thanks for reporting these issues. We've now fixed the PostBuild script. Unfortunately the build steps for publishing are very involved, but we can't see any way to shortcut this. These are just the steps that are enforced by Apple and Unity's app build process is what it is. We do have some notes and links in our PDF documentation to help with app setup, but most of the steps can be found on Unity's site here. We can't ship our plugin .bundle with a unique ID per user, so it is up to users to rename the ID when submitting.

    Thanks,
     
  50. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,615
    In the editor it is using a completely different playback engine (either Windows or MacOS), but we do try to make them all work the same. If you want to replay the movie it's always best to first call Rewind() then Play(). We'll try to fix this difference in the next update of the plugin. Thanks,
     
unityunity