Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

NatShare - Free Sharing API

Discussion in 'Assets and Asset Store' started by Lanre, Apr 17, 2018.

  1. fabiotgarcia

    fabiotgarcia

    Joined:
    Apr 28, 2017
    Posts:
    31
     
  2. mitchtbh

    mitchtbh

    Joined:
    Dec 8, 2013
    Posts:
    65
    Working fine on iPhoneX and iPhone 8. Tried on my iPad Air 2 and it crashes after recording 5 seconds of video. Seems like it could be a memory issue.
     
  3. fabiotgarcia

    fabiotgarcia

    Joined:
    Apr 28, 2017
    Posts:
    31
    Hi!

    It works only above iPhone 8? What about iPhone 5 and so on?
     
  4. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,658
    Try deleting and reimporting both NatCorder and NatShare from your project. We changed how file paths are handled on iOS in both NatCorder and NatShare, so you'll need both packages to be up to date.
     
  5. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,658
    NatCorder works on older devices (I've had a developer confirm that it works on the iPhone 4S). You just have to make sure that your recording framerate and resolution is manageable by the device. 30FPS is always a safe bet.
     
  6. fabiotgarcia

    fabiotgarcia

    Joined:
    Apr 28, 2017
    Posts:
    31
    Hi Lanre!

    We updated the NatCorder from 1.2f1 to 1.2f2 and now its working!
    NatShare was already up to date to 1.0f2

    Thanks so much for you support!
     
    Lanre likes this.
  7. fabiotgarcia

    fabiotgarcia

    Joined:
    Apr 28, 2017
    Posts:
    31
    Hi there!

    Recording on my iPhone 5C crash all the time. Its working fine on iPhone 6s.
    This is the message XCode get:
    Message from debugger: Terminated due to memory issue

    Is there any way to fix this?
    In attachment is the log file.

    Regards,

    Fabio
     

    Attached Files:

    Last edited: May 30, 2018
  8. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,658
    Hi Fabio. Please post on the NatCorder forum thread since this is a NatCorder issue, or email me directly since we have discussed over email. Older devices that do not support Metal and that have limited RAM size struggle with recording, especially when running other services like Vuforia that consume a lot of GPU frame time. What I recommend as a workaround is reducing the resolution of your recording.
     
  9. fabiotgarcia

    fabiotgarcia

    Joined:
    Apr 28, 2017
    Posts:
    31
    Thank you Lanre! I sent you an email.
     
    Lanre likes this.
  10. j_souhail

    j_souhail

    Joined:
    May 21, 2018
    Posts:
    4
    Hello,

    I have bought the NatCorder and added NatShare to it.
    I would like to ask for the possibility to add Description Text when sharing on social media. How is that possible?

    Thank you
     
  11. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    420
    Hello, does Save to camera roll save images to android gallery?
     
  12. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,658
    You can do so using the second parameter to the Share function.
     
  13. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,658
    Yes, on Android it saves to the gallery.
     
  14. muldercnc

    muldercnc

    Joined:
    Jun 22, 2013
    Posts:
    15
    Hi I am using NatShare and find its really good. I am just wondering if NatShare causes a requirement for access to the users contacts and to be able to make phone calls on Android? As people find this permission quite invasive. Is that permission from NatShare or should i be looking somewhere else? If it is from NatShare, can that requirement be removed?
     
  15. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,658
    NatShare doesn't declare these permissions; they are unrelated to its functionality.
     
    muldercnc likes this.
  16. walaber_entertainment

    walaber_entertainment

    Joined:
    Jul 10, 2017
    Posts:
    14
    Hi! thanks for making the awesome assets, both NatShare and NatCorder, I'm using them in my mobile game and they work great!

    I have a quick question: I don't want to keep around videos that players have recorded on disk, so after they share (or decide not to share) them, I'd like to delete them. However I can't seem to find any callback or anything for when the share action has completed, to know it's safe to delete the file. How do you recommend handling this without having to expose this as a player-facing decision?
     
  17. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,658
    This sounds like a good feature request. I have created an issue on GitHub.
     
  18. walaber_entertainment

    walaber_entertainment

    Joined:
    Jul 10, 2017
    Posts:
    14
    Thanks! I look forward to an update with the new feature. Until then I'll find a work-around for my use case.
     
    Lanre likes this.
  19. ANIMA-LT

    ANIMA-LT

    Joined:
    Nov 5, 2014
    Posts:
    16
    Hi, can anybody help me. I have NatCoder and NatShear imported from Asset store and added script

    Code (CSharp):
    1. void OnReplay (string path) {
    2.             NatShare.SaveToCameraRoll(path);
    3.  
    4.             Debug.Log("Saved recording to: "+path);
    5.             // Playback the video
    6.             #if UNITY_IOS
    7.             Handheld.PlayFullScreenMovie("file://" + path);
    8.             #elif UNITY_ANDROID
    9.             Handheld.PlayFullScreenMovie(path);
    10.             #endif
    11.         }
    But unity is writing
    Assets/NatCorder/Examples/ReplayCam/ReplayCam.cs(66,13): error CS0103: The name `NatShare' does not exist in the current context

    Thanks
     
    Last edited: Jun 27, 2018
  20. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,658
    You probably need to add "using NatShareU" at the top of your script.
     
  21. ANIMA-LT

    ANIMA-LT

    Joined:
    Nov 5, 2014
    Posts:
    16
    Thanks, I was looking for NatShare.. :) not for NatShareU
     
    Lanre likes this.
  22. wtrebella

    wtrebella

    Joined:
    Mar 18, 2013
    Posts:
    35
    Hi, I'm on NatShare 1.0f3, trying to share a video, but the share sheet never shows. This was working until very recently. I'm getting this output:

    Code (CSharp):
    1. 2018-07-03 01:02:54.116963-0500 myApp[34078:29208519] NatCorder: Prepared video track at resolution 374x374@30Hz with average bitrate 703125 and keyframe interval 3s
    2. 2018-07-03 01:02:54.120009-0500 myApp[34078:29208519] NatCorder: Prepared audio track for 2 channels with 1024@24000Hz samples
    3. 2018-07-03 01:03:04.114867-0500 myApp[34078:29208846] NatCorder: Encoder detected EOS marker
    4. 2018-07-03 01:03:04.114939-0500 myApp[34078:29208846] NatCorder: Encoder finishing
    5. 2018-07-03 01:03:10.698381-0500 myApp[34078:29208519] [ShareSheet] ERROR: <UIActivityViewController: 0x12a51f600> timed out waiting to establish a connection to the ShareUI view service extension.
    Any ideas?
     
  23. wtrebella

    wtrebella

    Joined:
    Mar 18, 2013
    Posts:
    35
    Weird. Just restarted my phone and everything's back to normal.
     
    Lanre likes this.
  24. furmank

    furmank

    Joined:
    May 24, 2017
    Posts:
    4
    HI,

    I enjoy very much using your plugin with NatCorder, thanks for the great work. I however have some issues and would need your help.
    - NatShare.Share(Texutre 2D) works great, but I'd like an option to set the file name (at the moment is share.png)
    - NatShare.SaveToCameraRoll has issues on Android - videos are saved to a folder with app name and pictures are saved to a folder named "Pictures". I'd like to save both in the folder named after the app.
    Both photos and videos are also saved with the wrong creation date (18. jan 1970) and I'm not able to change that with File.SetCreationTime.

    Have a nice one

    EDIT.
    I see the issue on github now, keeping fingers crossed that this becomes possible soon. The issue with the date is however still a big problem.
     
    Last edited: Jul 25, 2018
  25. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,658
    The `share.png` file is used as a temporary staging file to use to share the image, since we can't share raw pixel data. It is not meant to be consumed outside the scope of a call to Share(Texture2D).
    We are aware of this. There's a GitHub issue for this.
    I've opened a new issue for this on GitHub.
     
  26. furmank

    furmank

    Joined:
    May 24, 2017
    Posts:
    4
    Understood. The name can be seen for example when sent per mail.
    Great. I submitted a pull request for the issue.
     
  27. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,658
    Merged! Thank you.
     
  28. sooaolongtian1988

    sooaolongtian1988

    Joined:
    Aug 7, 2018
    Posts:
    2
    hi, any video tutorial on how to use this?
     
  29. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,658
    There isn't any video tutorial; the API is really simple. This article might be helpful.
     
  30. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,658
    ScreenShotShare is not a NatShare symbol. Contact the developer of the plugin you are using. All NatShare symbols begin with "NS".
     
  31. artofmining

    artofmining

    Joined:
    May 1, 2016
    Posts:
    29
    Is there any way to save the video (using NATCorder) to the actual android camera folder on an Android i.e. under DCIM folder?
    When I save a video it saves to a folder named "files" under the app installation inside /Internal storage/Android/Data/com.app.name. This causes problems when I try to view with android gallery. If I click the thumbnail I just get a grey box. If I try launching it it crashes gallery app. IF I access through another videos app I can access the video.
    Not sure if this is a bug or permissions issue?
     
  32. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,658
    This is an open issue.
    This is expected behaviour. NatCorder saves videos to the app's private documents directory. You can save the videos to the camera roll using NatShare.
     
  33. artofmining

    artofmining

    Joined:
    May 1, 2016
    Posts:
    29
    C
    Could you provide sample code how to save the newly created to camera roll using Natshare?
     
  34. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,658
    I'm not sure I understand your question. Newly created what? You can use the SaveToCameraRoll function to save media to the camera roll.
     
  35. gamingstudio17

    gamingstudio17

    Joined:
    Nov 24, 2013
    Posts:
    49
    On iOS does not work share in Instagram, how can I fix it?
     
  36. artofmining

    artofmining

    Joined:
    May 1, 2016
    Posts:
    29
    The MP4 Video
    When I use natshare(SaveToCameraRoll) the only place I see the video saved is in the files folder within application folder path

    This PC\Samsung Galaxy S7\Phone\Android\data\com.Aom.PitMouse\files
     
  37. saleems

    saleems

    Joined:
    Feb 14, 2018
    Posts:
    5
    Thanks for the great work on this plugin.

    I've noticed there are some binaries in the github repo as well, is this something you're able to open source as well?
     
  38. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,658
    Check out this issue. We will be pushing a NatShare update that implements this fix today or tomorrow.
     
  39. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,658
    This issue will make sure that the video is copied, instead of symlinked in the gallery folder.
     
    gamingstudio17 and artofmining like this.
  40. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,658
    The binaries are built from the native sources, in the iOS and Android folders at the root of the repository; it's all open source.
     
  41. rachidDev

    rachidDev

    Joined:
    May 19, 2017
    Posts:
    10
    when I use natshare API in Natcorder

    void OnReplay (string path) {
    Debug.Log("Saved recording to: "+path);
    // Playback the video
    #if UNITY_IOS
    Handheld.PlayFullScreenMovie("file://" + path);
    #elif UNITY_ANDROID
    NatShareU.NatShare.SaveToCameraRoll(path);
    Handheld.PlayFullScreenMovie(path);
    #endif
    }

    I see the video is saved in the app folder, I want it to save in Gallery Folder
     
    Last edited: Aug 21, 2018
  42. saleems

    saleems

    Joined:
    Feb 14, 2018
    Posts:
    5
    Ah of course. My apologies!
     
  43. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,658
    We will fix this in the next release.
     
  44. rachidDev

    rachidDev

    Joined:
    May 19, 2017
    Posts:
    10
    @NatCam thank you very much, I Wish I can save video with other name instead of recording_ prefix
     
  45. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,658
    This is not possible. Instead, you can rename the video file using the `System.IO.File` functions.
     
  46. Rich0

    Rich0

    Joined:
    Aug 9, 2013
    Posts:
    43
    I'm trying to share a MP4 created with NatCorder to Twitter & Instagram, however neither Twitter or Instagram appear in the sharing window. Both Twitter and Instagram are installed on the device. Any idea how to fix?
     
  47. gamingstudio17

    gamingstudio17

    Joined:
    Nov 24, 2013
    Posts:
    49
    Thanks
     
    Lanre likes this.
  48. artofmining

    artofmining

    Joined:
    May 1, 2016
    Posts:
    29
    Is this update still in development, I thought I saw a post that statin release this weeK? TY
     
  49. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,658
    We have implemented the fix. We will update the package on the Asset Store soon.
     
  50. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,658
    I have been a bit busy, so my progress on this was delayed. The fix has been implemented; I just have to run some tests then submit the package to Unity for review.
     
    artofmining likes this.