diff --git a/libresapi/src/webfiles/gui.jsx b/libresapi/src/webfiles/gui.jsx
index 9bc47c471..9df49c877 100644
--- a/libresapi/src/webfiles/gui.jsx
+++ b/libresapi/src/webfiles/gui.jsx
@@ -4,7 +4,15 @@ RS.start();
var api_url = window.location.protocol + "//" + window.location.hostname + ":" + window.location.port + "/api/v2/";
var filestreamer_url = window.location.protocol + "//" +window.location.hostname + ":" + window.location.port + "/fstream/";
-var upload_url = window.location.protocol + "//" +window.location.hostname + ":" + window.location.port + "/upload/";
+var upload_url = window.location.protocol + "//" + window.location.hostname + ":" + window.location.port + "/upload/";
+
+var extensions = {
+ mp3: "audio",
+ ogg: "audio",
+ wav: "audio",
+ webm: "video",
+ mp4: "video"
+};
// livereload
function start_live_reload()
@@ -558,7 +566,8 @@ var DownloadsWidget = React.createClass({
widget.emit("play_file", {name: file.name, hash: file.hash})
};
var playBtn =
;
- if(file.name.slice(-3) === "mp3")
+ var splits = file.name.split(".");
+ if(splits[splits.length-1].toLowerCase() in extensions)
playBtn = play
;
var ctrlBtn = ;
@@ -673,7 +682,7 @@ var SearchWidget = React.createClass({
},
});
-var AudioPlayerWidget = React.createClass({
+var MediaPlayerWidget = React.createClass({
mixins: [SignalSlotMixin],
getInitialState: function(){
return {file: undefined};
@@ -691,13 +700,28 @@ var AudioPlayerWidget = React.createClass({
}
else
{
- return(
-
-
{this.state.file.name}
-
-
- );
+ var splits = this.state.file.name.split(".");
+ var mediatype = extensions[splits[splits.length - 1].toLowerCase()];
+ if (mediatype == "audio") {
+ return (
+
+
{this.state.file.name}
+
+
+ );
+ } else if (mediatype == "video") {
+ return(
+
+
{this.state.file.name}
+
+
+ );
+ } else {
+ return();
+ }
}
},
});
@@ -1702,7 +1726,7 @@ var MainWidget = React.createClass({
}
mainpage = ;
diff --git a/libresapi/src/webui/gui.jsx b/libresapi/src/webui/gui.jsx
index 9bc47c471..9df49c877 100644
--- a/libresapi/src/webui/gui.jsx
+++ b/libresapi/src/webui/gui.jsx
@@ -4,7 +4,15 @@ RS.start();
var api_url = window.location.protocol + "//" + window.location.hostname + ":" + window.location.port + "/api/v2/";
var filestreamer_url = window.location.protocol + "//" +window.location.hostname + ":" + window.location.port + "/fstream/";
-var upload_url = window.location.protocol + "//" +window.location.hostname + ":" + window.location.port + "/upload/";
+var upload_url = window.location.protocol + "//" + window.location.hostname + ":" + window.location.port + "/upload/";
+
+var extensions = {
+ mp3: "audio",
+ ogg: "audio",
+ wav: "audio",
+ webm: "video",
+ mp4: "video"
+};
// livereload
function start_live_reload()
@@ -558,7 +566,8 @@ var DownloadsWidget = React.createClass({
widget.emit("play_file", {name: file.name, hash: file.hash})
};
var playBtn = ;
- if(file.name.slice(-3) === "mp3")
+ var splits = file.name.split(".");
+ if(splits[splits.length-1].toLowerCase() in extensions)
playBtn = play
;
var ctrlBtn = ;
@@ -673,7 +682,7 @@ var SearchWidget = React.createClass({
},
});
-var AudioPlayerWidget = React.createClass({
+var MediaPlayerWidget = React.createClass({
mixins: [SignalSlotMixin],
getInitialState: function(){
return {file: undefined};
@@ -691,13 +700,28 @@ var AudioPlayerWidget = React.createClass({
}
else
{
- return(
-
-
{this.state.file.name}
-
-
- );
+ var splits = this.state.file.name.split(".");
+ var mediatype = extensions[splits[splits.length - 1].toLowerCase()];
+ if (mediatype == "audio") {
+ return (
+
+
{this.state.file.name}
+
+
+ );
+ } else if (mediatype == "video") {
+ return(
+
+
{this.state.file.name}
+
+
+ );
+ } else {
+ return();
+ }
}
},
});
@@ -1702,7 +1726,7 @@ var MainWidget = React.createClass({
}
mainpage = ;