Fuse Community

Cameraview not working anymore on Android device

Hi,
i have update my fuse studio from 1.9.0 to 1.10 and cameraview is not working. is it an android tools version problem or what? Did someone have a solution for it.
here is the code:



	<WhileActive>
		<JavaScript>
			var Context = require("Modules/Context");
			var Observable = require("FuseJS/Observable");
			var Camera = _cameraView1;
			var state = false;

			Camera.setCaptureMode(Camera.CAPTURE_MODE_VIDEO)
				.then(function(newCaptureMode) {  
					})
        		.catch(function(error) { 
        			}); 

			Camera.setCameraFacing(Camera.CAMERA_FACING_FRONT)
				.then(function(newCameraFacing) { 
				 })
    			.catch(function(error) {
    			 });

    		var cameraBack = true;
			function flipCameraFacing() {
				var front = Camera.CAMERA_FACING_FRONT;
				var back = Camera.CAMERA_FACING_BACK;
				Camera.setCameraFacing(cameraBack ? front : back)
					.then(function (newFacing) {
						cameraBack = newFacing == back;
					})
					.catch(function (err) {
						
					});
				}

			var numContact=this.Parameter.map(function(param){return param.numero});
			var nomContact=this.Parameter.map(function(param){return param.noms});
			nomContact.subscribe(module);

			var ss = Observable("00");
			var mm = Observable("00");
			var hh = Observable("00");

			var date=new Date();

			var timeReceive=date.getTime();

			function goBack() {
				Context.addAppel(timeReceive, ""+hh.value+":"+mm.value+":"+ss.value, numContact.value , "Sortant", "video", nomContact.value)
				if(typeof timerID != 'undefined')
					clearInterval(timerID);
				state = false;
				var secondes=0;
				ss.value="00";
				var minutes=0;
				mm.value="00";
				var heures=0;
				hh.value="00";
				Camera=null;
				
				router.goBack();
			}

			function startTimer(){
				state = true;
				var secondes=0;
				ss.value="00";
				var minutes=0;
				mm.value="00";
				var heures=0;
				hh.value="00";

				timerID = setInterval(function(){
					secondes+=1;
					if(secondes<10)
						ss.value="0"+secondes;
					else
						ss.value=secondes;

					if(secondes>59){
						minutes+=1;
						secondes=0;
						ss.value="00";
						if(minutes<10)
							mm.value="0"+minutes;
						else
							mm.value=minutes;
					}

					if(minutes>59){
						heures+=1;
						minutes=0;
						mm.value="00";
						if(heures<10)
							hh.value="0"+heures;
						else
							hh.value=heures;
					}
				}, 1000);
			}
			//startTimer();
			module.exports = {
				goBack,
				ss,
				mm,
				hh,
				flipCameraFacing,
			};
		</JavaScript>
	</WhileActive>

	<DockPanel Dock="Fill" Width="100%" Height="100%" Margin="0, 0, 0, 0" Background="#8712d0">
		<Rectangle Color="#EF6A6A" Width="100%" Height="60" Alignment="Top" Margin="0, 0, 0, 0" Dock="Top">
			<StackPanel Alignment="Center">
				<Text TextColor="#fff" Font="textFontBold" Value="{nomContact}" FontSize="20" TextAlignment="Center" Alignment="Top" />
				<WhileTrue Value="{state}">
					<Text Font="textFont" FontSize="15" Value="Durée : {hh}:{mm}:{ss}" TextColor="#fff" Alignment="Center" Margin="0, 0, 0, 0" TextAlignment="Center" />
				</WhileTrue>
				<WhileFalse Value="{state}">
					<Text Font="textFontBold" FontSize="15" Value="Connexion..." TextColor="#fff" Alignment="Center" Margin="0, 0, 0, 0" TextAlignment="Center" />
				</WhileFalse>
			</StackPanel>
			
		</Rectangle>
		
		<Rectangle Dock="Top" Width="100%" Height="150" Alignment="Bottom" Layer="Overlay">
			<DockPanel Width="85%">
				<Circle Dock="Left" Alignment="CenterLeft" Color="#848484" Width="60" Height="60">
					<Image File="../Assets/Block Microphone_96px.png" Color="#000" Width="35" Height="35" />
				</Circle>
				<Circle Dock="Fill" Alignment="Center" Color="#F61212" Width="80" Height="80" Clicked="{goBack}">
					<Image File="../Assets/End Call_96px.png" Color="#fff" Width="50" Height="50" Alignment="Center" />
				</Circle>
				<Circle Dock="Right" Color="#848484" Width="60" Clicked="{flipCameraFacing}">
					<Image Width="35" Height="35" File="../Assets/Switch Camera_96px.png" Color="#000" />
				</Circle>
				<StackPanel Dock="Top" Orientation="Horizontal" Margin="0, 0, 0, 0" ItemSpacing="10" Alignment="CenterLeft" Visibility="Hidden">
					<Image File="../Assets/Add User Group Man Man_96px.png" Color="#8712d0" Width="30" />
					<Text Value="Joindre un ami" Font="textFont" TextColor="#8712d0" Margin="0, 5, 0, 0" />
				</StackPanel>
			</DockPanel>
		</Rectangle>
		<NativeViewHost Width="100%" Height="50%" Dock="Bottom" Padding="0, 0, 0, 0" Margin="0, 0, 0, 0" Alignment="BottomRight">
			<CameraView Alignment="BottomRight" ux:Name="_cameraView1" Width="100%" Height="100%" Margin="0, 0, 0, 0" Dock="Bottom" />
		</NativeViewHost>
	</DockPanel>
</DockPanel>

Wow, you were on 1.9, there’s been a lot of fixes: https://github.com/fuse-open/fuselibs/search?q=cameraview&type=Commits

I recommend keeping up-to-date with the latest: Fuse release 1.13

I didn’t understand any solution proposed in the link.
I also tried to update the fuse edition, but it seems that nothing changed.

You need to give us a small enough app to reproduce the issue; don’t know what you mean by not working as it definitely works.

Perhaps you’re not using the right version of Uno, you need to send screenshots too.

Is it only “not working” on android? What about iOS?

When i the app run correctly till i click to open the page containing the Cameraview.at this moment, the app stop running. I hqve a PC with windows 10, i cannot run for ios.
here is the screenshot of my powershell

It just sounds like you’re not using the latest version of Uno or Fuse SDK, so you need to sort out your installation first I see, did you try installing the dependencies mentioned in the error message that you need to install yourself?

The dependencies mentionned are about react native. I install then but it still like:

What version of npm are you using?

npm --version

Also, you can try installing fuse-sdk globally, by passing -g.

npm install fuse-sdk -g

npm --version is 6.12.0.
“npm install fuse-sdk -g” seems to work correctly.

1 Like