Giter Club home page Giter Club logo

unity_android_screen_recorder's Introduction

Unity_Android_Screen_Recorder

https://killertee.wordpress.com/2018/01/08/unity-android-record-game-screen-with-audio-using-your-ad-hoc-plug-in/

If you are using this library in one of your applications and would like to thank me:

Buy Me A Coffee

or via PayPal:

https://www.paypal.com/paypalme/kampertee

How to use

  • You need to create a gameobject name 'AndroidUtils' and add 'AndroidUtils.cs' script to it.
  • When you want to start capturing your screen, call 'androidUtils.StartRecording()'. 'androidUtils' is a reference to AndroidUtils.cs instance.
  • When you want to stop capturing your screen, call 'androidUtils.StopRecording()'. 'androidUtils' is a reference to AndroidUtils.cs instance.

A simple demo of AndroidUtils Plugin which provide 3 main function

  • Record android screen.
  • Request runtime permissions like Audio..
  • Refresh android gallery so you capture file will show up on top.

It also contains 2 helper functions

  • NativeShare for native send or share a video, image or text via social network, sms and email.
  • ShowToast show android toast message.

Note that

  • You might need to adjust the 'SCREEN_WIDTH' constant in AndroidUtils.cs for best video resolution. If 'SCREEN_WIDTH' is too big, your app may crash.
  • The plugin only support api 21 and higher.
  • Some Mediatek devices will crash if DEFAULT video encoder is used. Change to H264 may solve the problem.
androidRecorder.Call("setupVideo", width, height,bitrate, fps,audioEnable,VideoEncoder.H264.ToString());

Visit this site to get a details explaining of Unity_Android_Screen_Recorder.

https://killertee.wordpress.com/2018/01/08/unity-android-record-game-screen-with-audio-using-your-ad-hoc-plug-in/

unity_android_screen_recorder's People

Contributors

thanh-nguyen-kim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unity_android_screen_recorder's Issues

Doesn't start again

It starts and ends perfectly and also saves the file but it doesn't start again if I press start record.
While debugging I saw it is stuck on "preparing recorder". Any fixes?

Getting "path" null from ScreenRecorderService class.

I had integrated this plugin a year ago, and now I'm upgrading it to support Android 10 and above. With previous version, I was able to give my own path and filename. With this new version I wasn't able to give my own path or filename, which I'm okay with for now, but I'm trying to get the full path of the generated video (saved in gallery) from recording. I want the full path preferably when it's set. I'm using ScreenRecordService.getFilePath() in my main activity and passing the string to Unity using UnityPlayer.UnitySendMessage(). The returned string when logged in unity, prints as null/HD2020-11-27-18-23-34.mp4. I want full path of the video file so I can save it with my prefs, because I already have a native share up and running. And for that, I need the full path of the file for that to work.

No working with ARFoundation in Android

I added AR Session origin and AR Session onto sample scene provided with this repository,somehow it is not working;
AR Camera is not even opening,even it was tagged Main Camera.
Please let me know if there is any fix from you.
Have a good day.

Stop failed :(

AndroidPlayer([email protected])</i> 20190819-19:58:59 EXCEPTION UnityEngine.AndroidJavaException: java.lang.RuntimeException: stop failed.

Not sure why this is happening.

Full logcat:
new 2.txt

License

This looks useful for my project, what is the license for this code?

The duration of the output file is 0

When recording using this Asset, the duration of the output video is 0.
Do you know how to solve it?

If I copy the video to a Windows PC, the duration will be normal.

Can't record in Portrait orientation

Everything works great in left landscape orientation (haven't tried right), but when I switch in Project settings to Portrait or Auto Rotation it can't record. It pops a message "HBRecorderOnError see log" and saves an mp4 file with standard size that doesn't play.
Using Android Logcat I don't get anything useful, it took me a while to figure out it was the orientation that was blocking the recording. Unfortunately the app has to be in portrait mode.

Gives me an error of nosuchmethod at permission

Hi i have used your android screen recorder plugin from github in my project i have tested on my fresh new project its working fine but when i integrate in my real project it gives me

no such method error in this line :
androidUtils.GetStatic("currentActivity").Call("hasPermission", GetPermissionStrr(permission));

My unity version is 5.6.5
plugin used in my projects is easy movie texture and vuforia
can you please help me on this.

App Crash on Android 10

Hello,
application is properly build from Unity,but when i open app in my phone(Oneplus 6(Android 10))it crashes.
Please let me know if there is a fix for this issue.
Thank You.

Ignore UI

I have two cameras in my scene, one to render the UI and one to render everything else. I understand that this is probably using android intents so may not be possible but is there a way I can use this to record from only one camera rather than everything on screen?

Help with public static void ShareAndroid

Hello, could you please add in the README.md how to use the NativeShare (public static void ShareAndroid) for sharing a video?
By the way, I am using the plugin in Unity and it is recording well in a Note 10 plus devise. I had to comment:
//androidRecorder.Call("setupVideo", width, height,bitrate, fps,audioEnable,VideoEncoder.H264.ToString());//this line manual sets the video record setting. You can use the defaut setting by comment this code block

  Otherwise I get errors: "Some features  are not supported by your device.

I will appreciate any help with Sharing the video.
Best regards and thanks.

Can't record video in Samsung Device

Hi, when I tried to record video in Samsung Note8, it show this error in logcat.
image
And then in app, it toast a message said "Some settings are not supported by your device".
I have allowed storage permission and tried change the video encoder settings but issue still occur.

Any help will be appreciated, thanks

Usage with other main activiy

Hello,

I am currently using firebase and it already defines MAIN and LAUNCHER activities for my unity project.

If I define it like you show in your tutorial it creates a second launcher icon and the recording only works if you start via that second icon. Any way to fix this?

app is crashing when start recording

Hi, First of all thanks for this plugin. it was working fine when app was targeted to android api version 30. when I set target andorid version to android 12(api 31) or 12+, app is going to crash. does it not work in andorid 12,12+ devices?? Is there any solution for this?
please help!

Exception when opening file

I'm testing this on an android 27 device and seeing this error when hitting record:

HBRecorderOnError: java.io.FileNotFoundException: /storage/emulated/0/MoviesTee/HD2022-01-11-08-39-50.mp4: open failed: ENOENT (No such file or directory)

Any help is appreciated, thanks!

"HBRecorderOnError - See Log" in some devices

In some devices I'm having this message when I click in "Record" and give the permission, when I check the gallery there is a video with error... I try to use logcat to see what is happening but no message was displayed

can't set the solution

First,thank you for your scripts,its helpful in AR screen recording.
My problem is:
In AndroidUtils Start,i changed solution like this : androidRecorder.Call("setupVideo",720,1080,4,fps,audioEnable,"H264").
when i saved,the video's solution is same to the screen solution,just like 7201600, 10802400,1440*3200
my phone is samsung galaxy S20+,used ARFoundation 4.1.9

Any help will be appreciated, thanks

Can it record internal Audio

I want to use this plugin to record Gameplay video of my build but I don't want to record microphone audio I want only internal Game Audio, can it will be possible with this plugin ?

App Crashes

First of all thanks for this plugin , i downloaded the Project and get a build for POCO M3 it works fine but for other mobile it crashes

2024-02-28 18:11:35.773 15662 15662 Error AndroidRuntime java.lang.RuntimeException: Unable to start service com.hbisoft.hbrecorder.ScreenRecordService@88e88a3 with Intent { cmp=com.setik.androidutils/com.hbisoft.hbrecorder.ScreenRecordService (has extras) }: java.lang.IllegalArgumentException: com.setik.androidutils**: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.**

2024-02-28 18:11:35.773 15662 15662 Error AndroidRuntime Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
Capture

Cancel start recording

Hi,
When i pressed on startRecordbtn popup from phone opened(start recording btn, cancel btn ) .
i want when i pressed on cancel btn stopRecordBtn appeared and startRecordbtn disappeared how ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.