\"");
@@ -5673,7 +5823,7 @@ sub SSCam_logout_return ($) {
my $hash = $param->{hash};
my $name = $hash->{NAME};
my $sid = $hash->{HELPER}{SID};
- my ($success, $username) = SSCam_getcredentials($hash,0);
+ my ($success, $username) = SSCam_getcredentials($hash,0,"svs");
my $OpMode = $hash->{OPMODE};
my $data;
my $error;
@@ -5762,7 +5912,7 @@ sub SSCam_Autocreate ($$) {
CommandAttr(undef,"$camname httptimeout 20");
# Credentials abrufen und setzen
- my ($success, $username, $password) = SSCam_getcredentials($hash,0);
+ my ($success, $username, $password) = SSCam_getcredentials($hash,0,"svs");
if($success) {
CommandSet(undef, "$camname credentials $username $password");
}
@@ -5775,7 +5925,7 @@ sub SSCam_Autocreate ($$) {
}
return ($err,$camname);
-}
+}
###############################################################################
# Test ob JSON-String empfangen wurde
@@ -5906,7 +6056,8 @@ sub SSCam_snaplimsize ($) {
if(!AttrVal($name,"snapGalleryBoost",0)) {
$slim = 1;
- $ssize = 0;
+ $ssize = 0;
+ $ssize = 2 if(AttrVal($name,"snapEmailTxt","")); # Full Size für EMail-Versand, wird durch "snapGallerySize" überschrieben
} else {
$hash->{HELPER}{GETSNAPGALLERY} = 1;
$slim = AttrVal($name,"snapGalleryNumber",$SSCam_slim); # Anzahl der abzurufenden Snaps
@@ -6211,6 +6362,11 @@ return;
# Funktion für SSCamSTRM-Devices - Kamera Liveview weblink device
# API: SYNO.SurveillanceStation.VideoStreaming
# Methode: GetLiveViewPath
+#
+# $camname = Name der Kamaera (Parent-Device)
+# $strmdev = Name des Streaming-Devices
+# $fmt = Streaming Format
+#
######################################################################################
sub SSCam_StreamDev($$$) {
my ($camname,$strmdev,$fmt) = @_;
@@ -6273,7 +6429,40 @@ sub SSCam_StreamDev($$$) {
$pws =~ s/"//g if($pws);
my $StmKey = ReadingsVal($camname,"StmKey",undef);
+ # Javascript Bibliothek für Tooltips (http://www.walterzorn.de/tooltip/tooltip.htm#download) und Texte
+ my $calias = $hash->{CAMNAME}; # Alias der Kamera
+ my $ttjs = "/fhem/pgm2/sscam_tooltip.js";
+ my ($ttrefresh, $ttrecstart, $ttrecstop, $ttsnap, $ttcmdstop, $tthlsreact, $ttmjpegrun, $tthlsrun, $ttlrrun, $tth264run, $ttlmjpegrun, $ttlsnaprun);
+ if(AttrVal("global","language","EN") =~ /EN/) {
+ $ttrefresh = $SSCam_ttips_en{"ttrefresh"}; $ttrefresh =~ s/§NAME§/$calias/g;
+ $ttrecstart = $SSCam_ttips_en{"ttrecstart"}; $ttrecstart =~ s/§NAME§/$calias/g;
+ $ttrecstop = $SSCam_ttips_en{"ttrecstop"}; $ttrecstop =~ s/§NAME§/$calias/g;
+ $ttsnap = $SSCam_ttips_en{"ttsnap"}; $ttsnap =~ s/§NAME§/$calias/g;
+ $ttcmdstop = $SSCam_ttips_en{"ttcmdstop"}; $ttcmdstop =~ s/§NAME§/$calias/g;
+ $tthlsreact = $SSCam_ttips_en{"tthlsreact"}; $tthlsreact =~ s/§NAME§/$calias/g;
+ $ttmjpegrun = $SSCam_ttips_en{"ttmjpegrun"}; $ttmjpegrun =~ s/§NAME§/$calias/g;
+ $tthlsrun = $SSCam_ttips_en{"tthlsrun"}; $tthlsrun =~ s/§NAME§/$calias/g;
+ $ttlrrun = $SSCam_ttips_en{"ttlrrun"}; $ttlrrun =~ s/§NAME§/$calias/g;
+ $tth264run = $SSCam_ttips_en{"tth264run"}; $tth264run =~ s/§NAME§/$calias/g;
+ $ttlmjpegrun= $SSCam_ttips_en{"ttlmjpegrun"}; $ttlmjpegrun =~ s/§NAME§/$calias/g;
+ $ttlsnaprun = $SSCam_ttips_en{"ttlsnaprun"}; $ttlsnaprun =~ s/§NAME§/$calias/g;
+ } else {
+ $ttrefresh = $SSCam_ttips_de{"ttrefresh"}; $ttrefresh =~ s/§NAME§/$calias/g;
+ $ttrecstart = $SSCam_ttips_de{"ttrecstart"}; $ttrecstart =~ s/§NAME§/$calias/g;
+ $ttrecstop = $SSCam_ttips_de{"ttrecstop"}; $ttrecstop =~ s/§NAME§/$calias/g;
+ $ttsnap = $SSCam_ttips_de{"ttsnap"}; $ttsnap =~ s/§NAME§/$calias/g;
+ $ttcmdstop = $SSCam_ttips_de{"ttcmdstop"}; $ttcmdstop =~ s/§NAME§/$calias/g;
+ $tthlsreact = $SSCam_ttips_de{"tthlsreact"}; $tthlsreact =~ s/§NAME§/$calias/g;
+ $ttmjpegrun = $SSCam_ttips_de{"ttmjpegrun"}; $ttmjpegrun =~ s/§NAME§/$calias/g;
+ $tthlsrun = $SSCam_ttips_de{"tthlsrun"}; $tthlsrun =~ s/§NAME§/$calias/g;
+ $ttlrrun = $SSCam_ttips_de{"ttlrrun"}; $ttlrrun =~ s/§NAME§/$calias/g;
+ $tth264run = $SSCam_ttips_de{"tth264run"}; $tth264run =~ s/§NAME§/$calias/g;
+ $ttlmjpegrun= $SSCam_ttips_de{"ttlmjpegrun"}; $ttlmjpegrun =~ s/§NAME§/$calias/g;
+ $ttlsnaprun = $SSCam_ttips_de{"ttlsnaprun"}; $ttlsnaprun =~ s/§NAME§/$calias/g;
+ }
+
$ret = "";
+ $ret .= "";
$ret .= '';
$ret .= '';
$ret .= '';
@@ -6281,8 +6470,8 @@ sub SSCam_StreamDev($$$) {
if(!$StmKey || ReadingsVal($camname, "Availability", "") ne "enabled" || IsDisabled($camname)) {
# Ausgabe bei Fehler
my $cam = AttrVal($camname, "alias", $camname);
- $cause = !$StmKey?"Cam $cam has no Reading \"StmKey\" set !":"Cam \"$cam\" is disabled";
- $cause = "Cam \"$cam\" is disabled" if(IsDisabled($camname));
+ $cause = !$StmKey?"Camera $cam has no Reading \"StmKey\" set !":"Cam \"$cam\" is disabled";
+ $cause = "Camera \"$cam\" is disabled" if(IsDisabled($camname));
$ret .= " $cause
| ";
$ret .= '
';
$ret .= '';
@@ -6291,7 +6480,7 @@ sub SSCam_StreamDev($$$) {
return $ret;
}
- if($fmt =~ /mjpeg/) {
+ if ($fmt =~ /mjpeg/) {
if($apivideostmsmaxver) { # keine API "SYNO.SurveillanceStation.VideoStream" mehr ab API v2.8
$link = "$proto://$serveraddr:$serverport/webapi/$apivideostmspath?api=$apivideostms&version=$apivideostmsmaxver&method=Stream&cameraId=$camid&format=mjpeg&_sid=$sid";
} elsif ($hash->{HELPER}{STMKEYMJPEGHTTP}) {
@@ -6306,12 +6495,12 @@ sub SSCam_StreamDev($$$) {
if(ReadingsVal($camname, "Record", "Stop") eq "Stop") {
# Aufnahmebutton endlos Start
- $ret .= "$imgrecendless ";
+ $ret .= "$imgrecendless ";
} else {
# Aufnahmebutton Stop
- $ret .= "$imgrecstop ";
+ $ret .= "$imgrecstop ";
}
- $ret .= "$imgdosnap ";
+ $ret .= "$imgdosnap ";
$ret .= "";
if(AttrVal($camname,"ptzPanel_use",1)) {
my $ptz_ret = SSCam_ptzpanel($camname);
@@ -6329,7 +6518,7 @@ sub SSCam_StreamDev($$$) {
$ret .= " | " if(AttrVal($camname,"ptzPanel_use",0));
}
- } elsif($fmt =~ /generic/) {
+ } elsif ($fmt =~ /generic/) {
my $htag = AttrVal($camname,"genericStrmHtmlTag","");
if( $htag =~ m/^\s*(.*)\s*$/s ) {
$htag = $1;
@@ -6349,23 +6538,23 @@ sub SSCam_StreamDev($$$) {
$ret .= "";
$ret .= "$htag";
if($htag) {
- $streamHash->{HELPER}{STREAM} = "$htag"; # Stream für "get popupStream" speichern
+ $streamHash->{HELPER}{STREAM} = "$htag"; # Stream für "set popupStream" speichern
$streamHash->{HELPER}{STREAM} =~ s/["']//g;
$streamHash->{HELPER}{STREAM} =~ s/\s+/ /g;
$streamHash->{HELPER}{STREAMACTIVE} = 1; # Statusbit wenn ein Stream aktiviert ist
}
$ret .= " ";
Log3($strmdev, 4, "$strmdev - generic Stream params:\n$htag");
- $ret .= "$imgrefresh ";
+ $ret .= "$imgrefresh ";
$ret .= $imgblank;
if(ReadingsVal($camname, "Record", "Stop") eq "Stop") {
# Aufnahmebutton endlos Start
- $ret .= "$imgrecendless ";
+ $ret .= "$imgrecendless ";
} else {
# Aufnahmebutton Stop
- $ret .= "$imgrecstop ";
+ $ret .= "$imgrecstop ";
}
- $ret .= "$imgdosnap ";
+ $ret .= "$imgdosnap ";
$ret .= " | ";
if(AttrVal($camname,"ptzPanel_use",1)) {
my $ptz_ret = SSCam_ptzpanel($camname);
@@ -6374,26 +6563,72 @@ sub SSCam_StreamDev($$$) {
}
}
- } elsif($fmt =~ /switched/) {
+ } elsif ($fmt =~ /hls/) {
+ # es ist ein .m3u8-File bzw. ein Link dorthin zu übergeben
+ my $cam = AttrVal($camname, "alias", $camname);
+ my $m3u8 = AttrVal($camname, "hlsStrmObject", "");
+
+ if( $m3u8 =~ m/^\s*(.*)\s*$/s ) {
+ $m3u8 = $1;
+ $m3u8 =~ s/\$NAME/$camname/g;
+ }
+ my $d = $camname;
+ $d =~ s/\./_/; # Namensableitung zur javascript Codeanpassung
+
+ if(!$m3u8) {
+ $cause = "You have to specify attribute \"hlsStrmObject\" in Camera $cam !";
+ $ret .= " $cause
| ";
+ $ret .= '';
+ $ret .= '';
+ $ret .= '
';
+ $ret .= '';
+ return $ret;
+ }
+
+ $ret .= " ";
+ $ret .= SSCam_bindhlsjs ($camname, $strmdev, $m3u8, $d);
+
+ $streamHash->{HELPER}{STREAM} = ""; # Stream für "set popupStream" speichern
+ $streamHash->{HELPER}{STREAMACTIVE} = 1; # Statusbit wenn ein Stream aktiviert ist
+
+ $ret .= "$imgrefresh ";
+ $ret .= $imgblank;
+ if(ReadingsVal($camname, "Record", "Stop") eq "Stop") {
+ # Aufnahmebutton endlos Start
+ $ret .= "$imgrecendless ";
+ } else {
+ # Aufnahmebutton Stop
+ $ret .= "$imgrecstop ";
+ }
+ $ret .= "$imgdosnap ";
+ $ret .= " | ";
+ if(AttrVal($camname,"ptzPanel_use",1)) {
+ my $ptz_ret = SSCam_ptzpanel($camname);
+ if($ptz_ret) {
+ $ret .= "$ptz_ret | ";
+ }
+ }
+
+ } elsif ($fmt =~ /switched/) {
my $wltype = $hash->{HELPER}{WLTYPE};
$link = $hash->{HELPER}{LINK};
if($link && $wltype =~ /image|iframe|video|base64img|embed|hls/) {
if($wltype =~ /image/) {
$ret .= "')\"> " if($link);
- $streamHash->{HELPER}{STREAM} = ""; # Stream für "get popupStream" speichern
+ $streamHash->{HELPER}{STREAM} = ""; # Stream für "set popupStream" speichern
$streamHash->{HELPER}{STREAMACTIVE} = 1 if($link); # Statusbit wenn ein Stream aktiviert ist
- $ret .= "$imgstop ";
+ $ret .= "$imgstop ";
$ret .= $imgblank;
if($hash->{HELPER}{RUNVIEW} =~ /live_fw/) {
if(ReadingsVal($camname, "Record", "Stop") eq "Stop") {
# Aufnahmebutton endlos Start
- $ret .= "$imgrecendless ";
+ $ret .= "$imgrecendless ";
} else {
# Aufnahmebutton Stop
- $ret .= "$imgrecstop ";
+ $ret .= "$imgrecstop ";
}
- $ret .= "$imgdosnap ";
+ $ret .= "$imgdosnap ";
}
$ret .= " | ";
if(AttrVal($camname,"ptzPanel_use",1) && $hash->{HELPER}{RUNVIEW} =~ /live_fw/) {
@@ -6418,10 +6653,10 @@ sub SSCam_StreamDev($$$) {