1 Reply Latest reply on Apr 22, 2008 10:38 AM by imaaxa

    CF & Flash Streaming Server

    TheScarecrow Level 1
      I have a list of videos and I want the user to click on one. This loads the Flash movie page where the movie they clicked on loads. The code would get the video from a UIRL variable. However, what I do not know how to do is get the CF Code to load the movie. Does anyone know how to do this? Thanks
        • 1. Re: CF & Flash Streaming Server
          imaaxa Level 1
          I know there has to be a more simple way of doing this, but my work around was to place a flash player into my page so Dreamweaver would do most of the coding. The name of the .flv file is in the code twice. So I coped all of the code up to (but not including) the first entry of the .flv file name and pasted it into a MySQL table. Then I did the same thing for the code after the first .flv file name, and again for the code after the second time the .flv file name is listed. So now the code that Dreamweaver generated should now be divided up and stored in your MySQL table with out the .flv file name. It will be placed into the code later. (I left the file path in the code so all I have to do is build the code with these three data cells and the file name.)

          Next I did a SQL call from my cfc to get the data from the table:

          <cfinvoke component="cfc.flashCode" method="flash1" returnvariable="qFlash1"></cfinvoke>
          <cfinvoke component="cfc.flashCode" method="flash2" returnvariable="qFlash2"></cfinvoke>
          <cfinvoke component="cfc.flashCode" method="flash3" returnvariable="qFlash3"></cfinvoke>

          Test for a url variable and assign it to a variable named video, and if it is not defined give it a default value.
          <cfif isdefined("url.message")>
          <cfset video="#url.message#">
          <cfset video="open.flv">

          Then where I want the flash video to be I entered this code:

          <!--- This build the player code and inputs the video name in both places--->

          Next is the list of .flv videos. I started with a cfc SQL call to get the list:

          <cfinvoke component="cfc.flvList" method="flvsToPlay" returnvariable="qFlvs"></cfinvoke>

          Then I entered the code to make the list with a link tag that builds a link and passes the name of the .flv with the url

          <table border="0">
          <cfoutput query="qFlvs">
          <!--- Here is the link that passes the name with the url then displays the name as a link--->
          <a href="/services/media.cfm?message=#qFlvs.name#">#qFlvs.name#</a>

          This is working as of now. Here is the flashCode.cfc code to work with the MySQL tables.

          <cfcomponent displayName="flashCode.cfc" hint="Works with the flashCode Database">

          <!--- Gets and Returns a the first storage slot in the flashCode Database --->
          <cffunction name="flash1" access="public" returnType="query">
          <cfquery name="qFlash1">
          SELECT colName
          FROM table
          WHERE Id=1
          <cfreturn qFlash1>

          <!--- Gets and Returns a the second storage slot in the flashCode Database --->
          <cffunction name="flash2" access="public" returnType="query">
          <cfquery name="qFlash2">
          SELECT colName
          FROM table
          WHERE Id=2
          <cfreturn qFlash2>

          <!--- Gets and Returns a the third storage slot in the flashCode Database --->
          <cffunction name="flash3" access="public" returnType="query">
          <cfquery name="qFlash3">
          SELECT colName
          FROM table
          WHERE Id=3
          <cfreturn qFlash3>

          Here is the flvList.cfc code to work with the MySQL tables.

          <cfcomponent displayName="flvList" hint="Works with the flvList Database">
          <cffunction name="flvsToPlay" access="public" returntype="query">
          SELECT name
          FROM flvTableName
          ORDER BY id DESC
          <cfreturn qFlvs>

          I hope I made this easy enough to follow, and you can use it. If some one knows of an easier way to do this I could also use it. Thanks