cmdViewAnotherCamera method

dynamic cmdViewAnotherCamera()

Implementation

cmdViewAnotherCamera() async {
  if (outCamera.not()) {
    var x = await showDialog(
        context: context,
        builder: (context) {
          return XAlertDialog(
              title_Text: "Inserisci URL rtsp:",
              child: Column(mainAxisSize: MainAxisSize.min, children: [
                Row(children: [Expanded(child: XTextFormField(controller: urlRTSPcontroller, height: null))])
              ]),
              actionsBTNarea_Child: Row(children: [
                Expanded(
                    child: XBtnbase(
                        margin: EdgeInsets.symmetric(horizontal: 10),
                        label: "Annulla",
                        onPressed: () {
                          urlRTSP = "";
                          Navigator.pop(context, false);
                        },
                        label_Color: Colors.red)),
                Expanded(
                    child: XBtnbase(
                        margin: EdgeInsets.symmetric(horizontal: 10),
                        label: "Salva",
                        onPressed: () {
                          if (urlRTSPcontroller!.text != urlRTSP) {
                            urlRTSP = urlRTSPcontroller!.text;
                          } else {}
                          outCamera = outCamera.not();
                          Navigator.pop(context, true);
                        },
                        label_Color: Colors.green))
              ]));
        });
    setState(() {
      widget.onTakeMedia!(setState);
    });
    if (x != null && x) {
      // player.setOption(FijkOption.playerCategory, "mediacodec-all-videos", 1);
      // player = FijkPlayer();
      if (urlRTSP != null) {
        // await player.setDataSource(urlRTSP!, autoPlay: true); //'rtsp://admin:ldmospiti@192.168.1.120:554/live/CAM2'
      }
      // player.isPlayable();
    } else {
      outCamera = false;
    }

    setState(() {
      widget.onTakeMedia!(setState);
    });
  } else {
    setState(() {
      outCamera = outCamera.not();
    });
  }
}