User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 425,978 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,677 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 668 | Replies: 5
Reply
Join Date: Apr 2008
Posts: 3
Reputation: saji.ka is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
saji.ka saji.ka is offline Offline
Newbie Poster

How to include FLV videos in php

  #1  
Apr 9th, 2008
Dear All,

I am new to PHP. I would like to include video (Flash Videos) in the website using PHP. Can u please help by giving the code.

Saji
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2008
Posts: 43
Reputation: Daedal is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 11
Daedal's Avatar
Daedal Daedal is offline Offline
Light Poster

Re: How to include FLV videos in php

  #2  
Apr 9th, 2008
Originally Posted by saji.ka View Post
Dear All,

I am new to PHP. I would like to include video (Flash Videos) in the website using PHP. Can u please help by giving the code.

Saji


Here is code from a previous project of mine. Use as much or as little as you want. The function I have included really only uses 5 fields:
videoID
status
title
caption
embed_code

MySQL Videos Table
DROP TABLE IF EXISTS `videos`;
CREATE TABLE `videos` (
  `videoID` mediumint(8) unsigned NOT NULL auto_increment,
  `status` enum('Active','Disabled') NOT NULL default 'Active',
  `title` varchar(35) default NULL,
  `caption` text,
  `category` varchar(35) default NULL,
  `filename` varchar(35) default NULL,
  `embed_code` text,
  `video_date` date NOT NULL default '0000-00-00',
  PRIMARY KEY  (`videoID`)
) TYPE=MyISAM AUTO_INCREMENT=2 ;

-- 
-- Dumping data for table `videos`
-- 

INSERT INTO `videos` (`videoID`, `status`, `title`, `caption`, `category`, `filename`, `embed_code`, `video_date`) VALUES (1, 'Active', 'Lonely Angel', 'Kid Theodore''s Lonely Angel music video', 'www.kidtheodore.com', NULL, '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/l5os6oII8Hk"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/l5os6oII8Hk" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>', '2007-10-25')

PHP function to call the information from the database.
You would need to connect to your database first.

function getVideo($vid) {
//$vid = a videoID in the table videos
	$query = "SELECT * FROM videos WHERE status = 'Active' AND videoID = '$vid'"; 
	$result = mysql_query($query); 
  	  if (mysql_num_rows($result) > 0) {		
		$row = mysql_fetch_array( $result );
			$output .= "
			<h2>$row[title]</h2>
			$row[embed_code]<br>
			$row[caption]
			";
	  } else {
	  $output = "No video was found at this time.<br> Please check back soon.<br>";
	  }

			
return $output;
} //usage //echo getVideo($vid); 

Reply With Quote  
Join Date: Apr 2008
Posts: 3
Reputation: saji.ka is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
saji.ka saji.ka is offline Offline
Newbie Poster

Re: How to include FLV videos in php

  #3  
Apr 10th, 2008
Thank you very much . Is working and solved my problem.

Saji
Reply With Quote  
Join Date: Apr 2008
Posts: 3
Reputation: saji.ka is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
saji.ka saji.ka is offline Offline
Newbie Poster

Re: How to include FLV videos in php

  #4  
Apr 10th, 2008
Originally Posted by saji.ka View Post
Thank you very much . Is working and solved my problem.

Saji


The code worked fine with youtube video. When I replaced with my video it is a FLV file and its name is pv160308.flv, it is not working.

What I did ..

replaced the value="http://www.youtube.com/v/l5os6oII8Hk" and
src=" http://www.youtube.com/v/l5os6oII8Hk"
with local
value="pv160308.flv" and
src= "pv160308.flv".

When executed . no display is coming.

Could u pl. help

Saji
Reply With Quote  
Join Date: Apr 2008
Posts: 43
Reputation: Daedal is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 11
Daedal's Avatar
Daedal Daedal is offline Offline
Light Poster

Re: How to include FLV videos in php

  #5  
Apr 22nd, 2008
Originally Posted by saji.ka View Post
The code worked fine with youtube video. When I replaced with my video it is a FLV file and its name is pv160308.flv, it is not working.

What I did ..

replaced the value="http://www.youtube.com/v/l5os6oII8Hk" and
src=" http://www.youtube.com/v/l5os6oII8Hk"
with local
value="pv160308.flv" and
src= "pv160308.flv".

When executed . no display is coming.

Could u pl. help

Saji


I guess I misunderstood the question. You need to create an Adobe Flash FLV player... which would be a SWF file that has controls (play pause rewind) You could create this file to use a FLASHVAR to name the FLV file that you want to load in.
Ex:

src= "flvplayer.swf?video=pv160308.flv"

There would be a variable in your flash file called 'video' that it would load onto the scene.
Reply With Quote  
Join Date: Aug 2007
Location: Cavite,Philippines
Posts: 508
Reputation: ryan_vietnow is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 68
ryan_vietnow's Avatar
ryan_vietnow ryan_vietnow is offline Offline
Posting Pro

Re: How to include FLV videos in php

  #6  
Apr 22nd, 2008
you can try JW flash player.It's free and easy to use.
"death is the cure of all diseases..."
http://ryantetek.wordpress.com
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the PHP Forum

All times are GMT -4. The time now is 11:22 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC