@@ -52,6 +52,7 @@ function loadFileDir($file, $ROOT, $dirb)
52
52
// exit();
53
53
// }
54
54
?>
55
+ <script src="plugins/jstag/jsmediatags.min.js"></script>
55
56
<div class="dir-badge mdl-card mdl-shadow--2dp">
56
57
<?php
57
58
if (isset ($ dirb ) && $ dirb !== "/ " ) {
@@ -97,10 +98,49 @@ function loadFileDir($file, $ROOT, $dirb)
97
98
if (strpos (mime_content_type ($ main_path ), "video " ) !== false ) {
98
99
?>
99
100
<video style="width:100%;border:none" controls autoplay>
100
- <source type="video/mp4" src="<?php echo "/ " . $ dirb ; ?> ">
101
+ <source type="video/mp4" src="<?php echo "http:// " . $ _SERVER [ ' SERVER_NAME ' ] . BASEDIR . " / " . $ dirb ; ?> ">
101
102
</video>
102
103
<?php } elseif (strpos (mime_content_type ($ main_path ), "audio " ) !== false ) { ?>
103
- <audio src="<?php echo "/ " . $ dirb ; ?> " controls autoplay></audio>
104
+ <div id="audioInfo" style="display: none;">
105
+ <img src="assets/music-album.svg" id="artwork">
106
+ <div class="i4">
107
+ <p id="title"><span class="material-icons">list_alt</span>Title: </p>
108
+ <p id="artist"><span class="material-icons">person</span>Artist: </p>
109
+ <p id="album"><span class="material-icons">album</span>Album: </p>
110
+ </div>
111
+ </div>
112
+ <audio src="<?php echo "http:// " . $ _SERVER ['SERVER_NAME ' ] . BASEDIR . "/ " . $ dirb ; ?> " controls autoplay></audio>
113
+ <div id="nonArtwork">Icons made by <a href="https://www.flaticon.com/authors/prettycons" title="prettycons">prettycons</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a></div>
114
+ <script>
115
+ $('document').ready(function() {
116
+ var encode = function(d,a,e,b,c,f) {
117
+ c="";
118
+ for(a=e=b=0;a<4*d.length/3;f=b>>2*(++a&3)&63,c+=String.fromCharCode(f+71-(f<26?6:f<52?0:f<62?75:f^63?90:87))+(75==(a-1)%76?"\r\n":""))a&3^3&&(b=b<<8^d[e++]);
119
+ for(;a++&3;)c+="=";
120
+ return c
121
+ };
122
+ var jsmediatags = window.jsmediatags;
123
+ jsmediatags.read("<?php echo "http:// " . $ _SERVER ['SERVER_NAME ' ] . BASEDIR . "/ " . $ dirb ; ?> ", {
124
+ onSuccess: function(result) {
125
+ var mediaTitle = result.tags.title;
126
+ var mediaArtist = result.tags.artist;
127
+ var mediaAlbum = result.tags.album;
128
+ var mediaArtwork = result.tags.picture;
129
+ if(mediaTitle || mediaArtist) {
130
+ $('#audioInfo').css("display","flex");
131
+ $('#audioInfo #title').append(mediaTitle);
132
+ $('#audioInfo #artist').append(mediaArtist);
133
+ $('#audioInfo #album').append(mediaAlbum);
134
+ if(mediaArtwork !== "undefined") {
135
+ const { data, format } = mediaArtwork;
136
+ $('#audioInfo #artwork').attr("src", "data:" + format + ";base64," + encode(data));
137
+ $('#nonArtwork').css("display", "none");
138
+ }
139
+ }
140
+ }
141
+ });
142
+ });
143
+ </script>
104
144
<?php } else { ?>
105
145
this is not an audio/video file :<< đây hum phải là file VIDEO or AUDIO :v
106
146
<?php } ?>
0 commit comments