Error on VideoRecorder sample

2»

Posts

  • ChrisHonselaarChrisHonselaar NLBeta ✭✭✭
    RequestedOrientation = ScreenOrientation.Nosensor;
    

    You would do this just before calling PrepareVideoRecorder I guess. You should also retain the original value for RequestedOrientation and reset it after you're done recording, otherwise the user will not be able to rotate again of course :)

  • MassimilianoFabbriMassimilianoFabbri USMember ✭✭

    Now I have to pay you a beer + Pizza :D
    For the next answer please give me you paypal account (LOL)
    I have much questions ....

  • MassimilianoFabbriMassimilianoFabbri USMember ✭✭

    :( Sorry but Screeorientation o getRequestedOrientation or activityinfo are not recognized, maybe I'm missing some reference ?

  • ChrisHonselaarChrisHonselaar NLBeta ✭✭✭

    ScreenOrientation is in the Android.Content.PM namespace.

  • MassimilianoFabbriMassimilianoFabbri USMember ✭✭

    Thansk Chris. I followad a post on stackoverflow:

    prevOrientation = getRequestedOrientation();
    if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    } else if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    } else {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
    }

    Then to restore it

    setRequestedOrientation(prevOrientation);

    This code do not work, because getResources, setRequestedOrientation and ActivityInfo.SCREEN_ORIENTATION_NOSENSOR and so on are not recognized.

    Your solution works, but to record usin screenorientation the first attempt is cancelled because the screen is positioned on the default camera orientation.
    The above code seems to solve this problem, but I think they are java functions.
    How can I port to c#?
    Thanks for all support.
    I think this thread will be very usefull for many developers. ;)

  • ChrisHonselaarChrisHonselaar NLBeta ✭✭✭

    What do you mean by "to record usin screenorientation the first attempt is cancelled because the screen is positioned on the default camera orientation" exactly?

  • MassimilianoFabbriMassimilianoFabbri USMember ✭✭

    Putting your code in the recordButton click produces 2 effects.
    The screen orientation take the default orientation (just in case you are for example in portrait orientation) for the camera recording, and the camera.start is canceled. Then
    if you click again on Record button the camera recording starts.

  • ChrisHonselaarChrisHonselaar NLBeta ✭✭✭

    Ah ok, of course, because the activity restarts after the orientation change. Oof. Too tired right now, but let me think about that a bit.

  • ChrisHonselaarChrisHonselaar NLBeta ✭✭✭

    Ok actually the best solution here is probably to just specify the fixed orientation you actually want in the Manifest.xml for the recording activity:

    android:screenOrientation="landscape"
    

    This makes sense because the activity is focused on recording, and users will probably expect the layout to not change when previewing, recording or playing.

  • Hi Chris, Massimiliano,

    Just wanted to pass along that I was able to get the original project (downloaded last night) to work after making a couple of small changes. At first I was getting a FileNotFoundException for the recording file. After a lot of hacking I found that it worked after adding the WRITE_EXTERNAL_STORAGE permission and also using the AbsolutePath property of the ExternalStorageDirectory instead of the Name property. See my changes at this Github commit: https://github.com/DerickBeckwith/RecordVideo/commit/394afeeba3f54ecab91c5ac17d8d2b7181c87500

    Not sure if this example has been updated since last May but maybe this will help somebody.

    Best regards,
    Derick

  • aloisalois USMember ✭✭

    thanks Chris you made my day, i had the same problem but your example saved my day.

Sign In or Register to comment.