Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preview Client Issue #58

Closed
dhivya29 opened this issue Dec 13, 2023 · 4 comments
Closed

Preview Client Issue #58

dhivya29 opened this issue Dec 13, 2023 · 4 comments

Comments

@dhivya29
Copy link

dhivya29 commented Dec 13, 2023

@yohei @japboy @togacy @mhirose
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?,
): View {
_binding = FragmentThetaCameraBinding.inflate(inflater, container, false)
return binding.root
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)


    lifecycleScope.launch {

        val thetaUrl = "https://fake-theta.vercel.app/"
        val thetaConfig = ThetaRepository.Config()
        thetaConfig.language = ThetaRepository.LanguageEnum.EN_US
        thetaConfig.shutterVolume = 40 // 0 to 100
        thetaConfig.sleepDelay = ThetaRepository.SleepDelayEnum.SLEEP_DELAY_5M
        thetaConfig.offDelay = ThetaRepository.OffDelayEnum.DISABLE
        thetaRepository = newInstance(thetaUrl, thetaConfig)
        thetaRepository?.getOptions(
            listOf(
                ThetaRepository.OptionNameEnum.CameraMode,
                ThetaRepository.OptionNameEnum.PreviewFormat,
                ThetaRepository.OptionNameEnum.CameraControlSource,
                ThetaRepository.OptionNameEnum.CaptureMode
            )
        )?.let { thetaRepository?.setOptions(it)

        }
    }


   
     startPreview()
}

private fun startPreview() {
lifecycleScope.launch {
try {
thetaRepository?.getLivePreview()?.collect { byteReadPacket ->

                   if (isActive) {
                       byteReadPacket.inputStream().use {
                           val bitmap = BitmapFactory.decodeStream(byteReadPacket.inputStream())

/ Glide.with(requireContext())
// .load(bitmap)
// .into(binding.imgTheta)
byteReadPacket.release()
}
} else {
Log.e("ThetaCameraFragment", "FALSE")

                   }
               }
           } catch (e: Exception) {
               Log.e("ThetaCameraFragment", "Error during live preview: ${e.message}", e)
               // Handle the error as needed
           }
       }
   }

With this code preview client is not worked
Kindly let me know the process of initializing preview Client

@simago
Copy link
Contributor

simago commented Dec 14, 2023

@dhivya29 You use fake theta. Its protocol is https but theta client preview function does not support https.

@dhivya29
Copy link
Author

@dhivya29 You use fake theta. Its protocol is https but theta client preview function does not support https.

When i use real ip address of the device with theta client means it will work or not?
I have downloaded demo app too and in that also preview is not working why?

@simago
Copy link
Contributor

simago commented Dec 18, 2023

@dhivya29 When using real Theta, preview of the demo should work.
In the next release, Android demo will be improved a little. Please try it.

@codetricity
Copy link

@dhivya29 I tested theta-client with the SC2 and it works on Android native.

https://youtu.be/shg2kX7Q8pM?si=QwM1gH0puKv0GjkM

What RICOH THETA model are you using?

Note that I don't work for RICOH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants