Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Quote:
I am designing a webpage on asp.net with C# as programming language. I would like to embed YouTube video on my webpage. The YouTube video URL is coming from database.
The user has right to update his YouTube video for that there is one textbox in which they paste the YouTube video embed code and submit it and the YouTube video embed code got inserted in database.
The video is being displayed on webpage through literal control. But the problem is that when that video displays on webpage taking the YouTube video URL from database it is of very large size as embed code contains width ="853" height="480" parameter also.
I would like to display the video of width="300" and height ="250". How to do this. Please help me.


What I have tried:

Quote:
Posted
Updated 19-May-20 23:32pm

1 solution

You could do it with a RegEx expression, but as these are not very easy to use here is a helper library: I don't like Regex...[^]
This way you can extract e.g. the width with a pattern like "width =\"*\""

Another simple idea is to use a placeholder that you can easily replace with a string, something like this:
width ="{mywidth}" height="{myheight}" 
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900