From fa4bcf5f03a8b2fc45faa1aef8f0c8ff4dd616b6 Mon Sep 17 00:00:00 2001 From: ulrich <ulrich@ulrich-vaio> Date: Mon, 29 Mar 2021 19:49:19 +0000 Subject: [PATCH] VLCPlayer Pause Seek in Arbeit --- src/de/uhilger/avdirektor/handler/FileHandler.java | 29 +++++++++++++++++++++++------ 1 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/de/uhilger/avdirektor/handler/FileHandler.java b/src/de/uhilger/avdirektor/handler/FileHandler.java index 1583694..7721d97 100644 --- a/src/de/uhilger/avdirektor/handler/FileHandler.java +++ b/src/de/uhilger/avdirektor/handler/FileHandler.java @@ -1,8 +1,25 @@ +/* + AV-Direktor - Control OMXPlayer on Raspberry Pi via HTTP + Copyright (C) 2021 Ulrich Hilger + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ + package de.uhilger.avdirektor.handler; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; -import de.uhilger.avdirektor.App; import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -19,7 +36,7 @@ private static final Logger logger = Logger.getLogger(FileHandler.class.getName()); - private String basePath; + private final String basePath; public FileHandler(String basePath) { this.basePath = basePath; @@ -34,10 +51,10 @@ fName += "index.html"; } OutputStream os = t.getResponseBody(); - File outFile = new File(basePath, fName); - if(outFile.exists()) { - t.sendResponseHeaders(200, outFile.length()); - InputStream in = new FileInputStream(outFile); + File file = new File(basePath, fName); + if(file.exists()) { + t.sendResponseHeaders(200, file.length()); + InputStream in = new FileInputStream(file); int b = in.read(); while(b > -1) { os.write(b); -- Gitblit v1.9.3