最終更新日 :
2025年3月31日
警告 :
すべてのモバイル機能とモバイル関連機能は ColdFusion(2025リリース)で削除されました。
詳しくは、ColdFusion の非推奨の機能を参照してください。
開始する前に、オーディオ関数を参照してください。
オーディオキャプチャの簡単な例
<cfclientsettings enableDeviceAPI=true> <cfclient> <cfset opt = cfclient.audio.getOptions()> <cfset cfclient.audio.capture(opt,'func1')> <cffunction name="func1"> <cfargument name="mediaFileArray"> <cfset document.getElementById('result').innerHTML="<br>Value from callback function"> <cfset document.getElementById('result').innerHTML=document.getElementById('result').innerHTML+JSON.stringify(mediaFileArray)> <cfset document.getElementById('result').innerHTML=document.getElementById('result').innerHTML+mediaFileArray[1].fullPath> </cffunction> </cfclient> <div id="result"/>
オーディオの録音と再生
<cfclient> <cfset mediaFileArray=cfclient.audio.capture()> <cfset medFil=mediaFileArray[1].fullPath> <!--- メディアファイルを再生します ---> <cffunction name="playing"> <cfset medObj = cfclient.audio.play(medFil)> </cffunction> <!--- メディアを一時停止します ---> <cffunction name="pausing"> <cfset cfclient.audio.pause(medObj)> </cffunction> <!--- メディアをリリースします ---> <cffunction name="releasing"> <cfset cfclient.audio.release(medObj)> </cffunction> <!--- メディアを停止します ---> <cffunction name="stopping"> <cfset cfclient.audio.stop(medObj)> </cffunction> <!--- メディアファイルの現在の位置を取得します ---> <cffunction name="getcurpos"> <cfset pos = cfclient.audio.getCurrentPosition(medObj)> </cffunction> <!--- メディアファイルの位置に移動します ---> <cffunction name="seekingto"> <cftry> <cfset pos = cfclient.audio.seekTo(medObj,2)> <cfcatch type="any"> <cfset alert(cfcatch.message)> </cfcatch> </cftry> </cffunction> <!--- 録音を開始します ---> <cffunction name="rec"> <cftry> <cfset pos = cfclient.audio.record(medObj)> <cfcatch type="any"> <cfset alert(cfcatch.message)> </cfcatch> </cftry> </cffunction> <cffunction name="stoprec"> <cfset cfclient.audio.stopRecording(medObj)> </cffunction> </cfclient>