Is there anyway to stream an audio file without giving complete path
of the file.
For example whenever we tried to play mp3
file with HTML5 Audio tag or With javascript, then i have to supply complete path of mp3 file something like this
<audio controls>
<source src="http://example.com/file/hello_name.mp3" type="audio/mpeg">
</audio>
So, i think can we supply an id
of the mp3 file instead of complete path
of the file which should be something like this:
<audio controls>
<source src="http://example.com/stream.php?file_id=111" type="audio/mpeg">
</audio>
Your stream.php file will look like this:
<?php
// Say you hava a table "file_paths" with two columns file_id and file_path
$sql = $pdo->prepare("SELECT FROM file_paths WHERE file_id = ?");
$sql->bindValue(1, $_GET['file_id'], PDO::PARAM_INT);
$sql->execute();
$fetch = $sql->fetchObject();
// retrieve file path using its id
$path = $fetch->file_path;
header("Location: " . $path);
?>
And then on target page, add the player by passing file_id to stream.php like this:
<audio controls>
<source src="stream.php?file_id=123" type="audio/mpeg">
</audio>
I have two .env files like dev.env and staging.env. I am using typeorm as my database ORM. I would like to know how to let typeorm read either of the config file whenever I run the application. Error: ...
I have two .env files like dev.env and staging.env. I am using typeorm as my database ORM. I would like to know how to let typeorm read either of the config file whenever I run the application. Error: ...
I have a reference to a component <Gmap ref="mapRef"> In mounted I am doing this, just to see the objects are available mounted(){ let self = this console.log(self.$refs) // Shows the ...
I have a reference to a component <Gmap ref="mapRef"> In mounted I am doing this, just to see the objects are available mounted(){ let self = this console.log(self.$refs) // Shows the ...
I developed in and published a game to the Play Store made with the Phaser gaming engine and Cordova. When this game is good enough, I would like to publish it to the App Store, but I've read that ...
I developed in and published a game to the Play Store made with the Phaser gaming engine and Cordova. When this game is good enough, I would like to publish it to the App Store, but I've read that ...
Django 1.8 and python 2.7. I am trying to update the location of a marker using jQuery and Ajax. My json object has only one array: [{"latitud": "55.75222", "ciudad": "Moscu", "longitud": "37.61556"...
Django 1.8 and python 2.7. I am trying to update the location of a marker using jQuery and Ajax. My json object has only one array: [{"latitud": "55.75222", "ciudad": "Moscu", "longitud": "37.61556"...