waynew Posted August 26, 2008 Share Posted August 26, 2008 Ok, I'm creating a niche social network as a personal project and want to allows users to be able to add a Youtube video to their profile. Now I had originally gone with the following code, but alas, it doesn't seem to work. Just a blank embedded object. <?php if($user_details['youtube_video'] != NULL){ echo '<div id="youtube">'; echo '<object width="400" height="324"><param name="movie" value="'.$user_details['youtube_video'].'&hl=en&fs=1&color1=0xe1600f&color2=0xfebd01"></param><param name="allowFullScreen" value="true"></param><embed src="'.$user_details['youtube_video'].'&hl=en&fs=1&color1=0xe1600f&color2=0xfebd01" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object>'; echo '</div>'; } ?> I am not allowing users to embed their own objects etc, for the obvious reasons. So, is there anyway that would allow users to simply paste a Youtube video URL in and have it play with the player I picked? Quote Link to comment https://forums.phpfreaks.com/topic/121408-youtube-video/ Share on other sites More sharing options...
Fadion Posted August 26, 2008 Share Posted August 26, 2008 The code looks ok assuming your users are posting the full video url (youtube.com/blahblah). That code should embed the youtube flash video player, so you can't just play it with a player of your choice. Quote Link to comment https://forums.phpfreaks.com/topic/121408-youtube-video/#findComment-626056 Share on other sites More sharing options...
waynew Posted August 26, 2008 Author Share Posted August 26, 2008 I've been testing and entered a full URL. (Note: Not the embed source) Yet still nothing. As you can see, the array $user_details holds the URL to the Youtube Video Quote Link to comment https://forums.phpfreaks.com/topic/121408-youtube-video/#findComment-626067 Share on other sites More sharing options...
turkman Posted August 26, 2008 Share Posted August 26, 2008 i remember one time that youtube works a little different i don't think you have to enter the link in the address bar to play the video, i think its the unique video name but it plays it in something like player.swf i remember because in bebo before you could enter youtube videos you had a hack where you enter the player.swf thing and it would play them. Quote Link to comment https://forums.phpfreaks.com/topic/121408-youtube-video/#findComment-626073 Share on other sites More sharing options...
JonnoTheDev Posted August 26, 2008 Share Posted August 26, 2008 Dont think you can do this although maybe wrong. You have to use the embed src provided by YouTube for the video you want to play. Not sure they allow you to link directly to videos from other players. Quote Link to comment https://forums.phpfreaks.com/topic/121408-youtube-video/#findComment-626086 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.