Determining when a video has finished playing using the CFMEDIAPLAYER tag in ColdFusion 9

Readability

Determining when a video has finished playing using the CFMEDIAPLAYER tag in ColdFusion 9

The fol­low­ing exam­ple shows how you can deter­mine when a Flash Player video has fin­ished play­ing by spec­i­fy­ing the onComplete attribute of the <CFME­DI­APLAYER> tag in Cold­Fu­sion 9.



    



    
 
    
 


And the debug out­put from the <textarea> tag is as fol­lows:

The following example shows how you can determine when a Flash Player video has finished playing by specifying the onComplete attribute of the <CFMEDIAPLAYER> tag in ColdFusion 9.

<html>
<head>
    <script type="text/javascript">
        function cfmediaplayer_onLoadHandler() {
            debbie.value += "[" + getTime() + "] onLoad function called.\n";
        }
        function cfmediaplayer_onStartHandler() {
            debbie.value += "[" + getTime() + "] onStart function called.\n";
        }
        function cfmediaplayer_onCompleteHandler() {
            debbie.value += "[" + getTime() + "] onComplete function called.\n";
        }
        function getTime() {
            return new Date().toTimeString().split(" ")[0];
        }
    </script>
</head>
<body style="padding:20px;">
 
    <cfmediaplayer name="flvPlayer"
            source="http://helpexamples.com/flash/video/caption_video.flv"
            onLoad="cfmediaplayer_onLoadHandler"
            onStart="cfmediaplayer_onStartHandler"
            onComplete="cfmediaplayer_onCompleteHandler" />
 
    <textarea id="debbie" cols="40" rows="10"></textarea>
 
</body>
</html>

And the debug output from the <textarea> tag is as follows:

2 thoughts on “Determining when a video has finished playing using the CFMEDIAPLAYER tag in ColdFusion 9”

  1. I’m trying to figure out a way to use this tag to sync PowerPoint slides to a video on a webpage. Would it be possible to use getTime to display specific images on the page at specific times?

  2. We’re looking for a way to make the cfmediaplayer replay the FLV after it completes, so the player loops continuously. Can you help?

Leave a Reply

Your email address will not be published.