# Custom camera preview size

**URL:** <https://community.wowza.com/t/custom-camera-preview-size/47251>\
**Category:** Wowza GoCoder SDK\
**Created:** [July 13, 2016, 4:07pm UTC](https://community.wowza.com/t/custom-camera-preview-size/47251 "2016-07-13T16:07:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexey\_Berkov](https://avatars.discourse-cdn.com/v4/letter/a/838e76/32.png) [@Alexey\_Berkov](https://community.wowza.com/u/Alexey_Berkov)\
**Post date:** [July 13, 2016, 4:07pm UTC](https://community.wowza.com/t/custom-camera-preview-size/47251/1 "2016-07-13T16:07:24Z")

</div>

Part of layout from sample app (activity\_camera.xml):

```auto
<FrameLayout
        android:id="@+id/cameraView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#0d0d0d">
        <com.wowza.gocoder.sdk.api.devices.WZCameraView
            android:id="@+id/cameraPreview"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            wowza:defaultCamera="back"
            wowza:frameSizePreset="frameSize1280x720"
            wowza:scaleMode="fill" />
</FrameLayout>

```

and in this case all works right, ok…

but I need to set custom camera preview size.

If I set size of WZCameraView to

```auto
android:layout_width="90dp"
android:layout_height="120dp"

```

then I got error:

```auto
W/b: a was in an unexpected state. Expected: READY, Actual: IDLE
E/b: A broadcast component reported the following error during the START_BROADCAST transition
                                                                 severity : ERROR
                                                                 error class : WZStreamingError
                                                                 error code : 33
                                                                 description : A session component was in an invalid transition state
W/WZBroadcast: Ending the broadcast session due to an error that occurred during the READY to RUNNING transition
W/b: a was not running at broadcast teardown. It was in a IDLE state

```

this error may be workarounded - I can set size for “@+id/cameraView” (parent FrameLayout), not “@+id/cameraPreview”. But this works only in sample app.

In my real application with custom layout I still get “invalid transition state” error.

Is there any way to use WZCameraView with custom size and in “not-sample-app-like” layouts?

---

<div class="post-metadata">

**Author:** ![Alexey\_Berkov](https://avatars.discourse-cdn.com/v4/letter/a/838e76/32.png) [@Alexey\_Berkov](https://community.wowza.com/u/Alexey_Berkov)\
**Post date:** [July 13, 2016, 5:47pm UTC](https://community.wowza.com/t/custom-camera-preview-size/47251/2 "2016-07-13T17:47:20Z")

</div>

I spent half day, and found that:

this works:

```auto
<RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <FrameLayout
            android:id="@+id/cameraView"
            android:layout_width="90dp"
            android:layout_height="120dp"
            android:layout_gravity="center"
            android:background="#0d0d0d">
            <com.wowza.gocoder.sdk.api.devices.WZCameraView
                android:id="@+id/cameraPreview"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                wowza:defaultCamera="back"
                wowza:frameSizePreset="frameSize1280x720"
                wowza:scaleMode="fill" />
        </FrameLayout>
    </RelativeLayout>

```

and this - not:

```auto
<FrameLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <FrameLayout
            android:id="@+id/cameraView"
            android:layout_width="90dp"
            android:layout_height="120dp"
            android:layout_gravity="center"
            android:background="#0d0d0d">
            <com.wowza.gocoder.sdk.api.devices.WZCameraView
                android:id="@+id/cameraPreview"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                wowza:defaultCamera="back"
                wowza:frameSizePreset="frameSize1280x720"
                wowza:scaleMode="fill" />
        </FrameLayout>
    </FrameLayout>

```

---

<div class="post-metadata">

**Author:** ![sal\_jefferson](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@sal\_jefferson](https://community.wowza.com/u/sal_jefferson)\
**Post date:** [July 24, 2016, 12:44pm UTC](https://community.wowza.com/t/custom-camera-preview-size/47251/3 "2016-07-24T12:44:36Z")

</div>

Is this issue resolved? If not I would suggest opening a support ticket, or possibly seeking aid from a Wowza endorsed consultant.

To open a ticket, please [follow these steps](https://www.wowza.com/support/open-ticket)

To request a consultant please post to the [find a consultant forum](http://community.wowza.com/c/-/7)

Regards,

Salvadore

---

<div class="post-metadata">

**Author:** ![Alexey\_Berkov](https://avatars.discourse-cdn.com/v4/letter/a/838e76/32.png) [@Alexey\_Berkov](https://community.wowza.com/u/Alexey_Berkov)\
**Post date:** [July 14, 2016, 6:14pm UTC](https://community.wowza.com/t/custom-camera-preview-size/47251/4 "2016-07-14T18:14:35Z")

</div>

works well with last version (1.0.0.177)
