• September 7, 2018

    can not run by echo

    ต้องกด refresh 1 ครั้งจึงจะทำงาน

    echo "<audio autoplay loop><source src='hit.mp3'></audio>";
    
    จึงใช้ code นี้ใน echo เพื่อ reload 1 ครั้ง
    +https://stackoverflow.com/questions/6985507/one-time-page-refresh-after-first-page-load

    Just 1 time con not loop (non standard tax)

    echo '<embed src="hit.mp3" autostart="true" loop="TRUE"></embed>';
    echo '<div style="visibility:hidden"><embed src="hit.mp3" autostart=true loop=false></div>';
    echo '<embed src="hit.mp3" autostart="true" loop="false" hidden="true">';
    echo '<embed src="hit.mp3" loop="true" autostart="true" style="visibility:hidden;"/>';
    
    
    $myAudioFile = "myAudiofile.wav";
    echo '<EMBED SRC="'.$myAudioFile.'" HIDDEN="TRUE" AUTOSTART="TRUE"></EMBED>';
    
    
    <html>
    <head>
    <title>ThaiCreate.Com jQuery Tutorials</title>
    <script type="text/javascript" src="jquery-1.6.4.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    
    	$("#btn1").click(function(){
    		$("#div1").hide(1000);
    	});
    
    	$("#btn2").click(function(){
    		$("#div1").show(1000);
    	});
    
    });
    </script>
    </head>
    <body>
    <div id="div1">www.ThaiCreate.Com</div>
    <input type="button" id="btn1" value="Hide">
    <input type="button" id="btn2" value="Show">
    http://www.thaicreate.com/jquery/jquery-effects.html
    
    

    my php code to fetch all sound files, random way, in a folder is this:

    $files = glob("audio/*.mp3");
    $random = $files[array_rand($files)];

    and to play them i use:

    <audio src="<?php echo $random; ?>" width="400" height="200" controls></audio>
    ans
    <a onclick="this.firstChild.play()"><audio src="<?php echo $random; ?>"></audio>&#9658;</a>
    
    

    This should do it:

    $files = glob("/path/to/directory/*.mp3");
    $random = array_rand($files)

    Then do this:

    <embed src="<?php echo $random ?>" 
    width="140" height="40" autostart="true" loop="TRUE"> 
    </embed> 
    <?php
    $files = glob("assets/songs/SayYesToLove/*.mp3");
    $random = array_rand(array($files));
    ?>

    next add this just outside that php code in the body

    <embed src="<?php echo $files[$random]; ?>" width="140" height="40" autostart="true" loop="TRUE">
    </embed>

    อื่นๆ

    +https://snipplr.com/view/63264/php-conditionals-to-echo-proper-audio-tags/



เวอไนน์ไอคอร์ส

ประหยัดเวลากว่า 100 เท่า!






เวอไนน์เว็บไซต์⚡️
สร้างเว็บไซต์ ดูแลเว็บไซต์

Categories