Click here to Skip to main content
14,491,885 members
Rate this:
Please Sign up or sign in to vote.
See more:
Actually in my web form i am using HTML5 video player in one site i seen a example i just copy pasted it is working but when i downloaded that video from that link i kept that video in my c drive and given src=path it is not playing here below is my code

Below code is working

<video id="video1" width="420">
    <source src="" type="video/mp4">
    Your browser does not support HTML5 video.

Below code is not working

<video id="video1" width="420">
    <source src="" type="video/mp4">
    Your browser does not support HTML5 video.

is there any problem in my code..
Updated 15-Mar-14 1:49am

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Here you can use either absolute or relative urls only.

Possible values:

An absolute URL - points to another web site (like src="")

A relative URL - points to a file within a web site (like src="small.mp4")

When you add video into your web site,you can use it as below:
<video width='300' height='200' controls>
    <source src="/PtImages/Sravi-klokesh/Priorus-1394794109.mp4" type="video/mp4"/>
    <p>Fallback code if video isn't supported</p>/
ntitish 15-Mar-14 1:54am
how can it get the video from the computer if i given simply src="small.mp4" the video is not in my project outside the project..
Sampath Lokuge 15-Mar-14 1:55am
You have to add it into your project.Otherwise it will not work.
ntitish 15-Mar-14 1:58am
ok sir even in my project also i am saving in folder like this i am saving in the project


then how to give src
Sampath Lokuge 15-Mar-14 2:00am
Is above folder located under the Web site root ?
ntitish 15-Mar-14 2:03am
yes sir for example i am giving one link which is related to my project

source src="" /

when i use that URL out side the video is playing but when attached to src it is not playing.
Sampath Lokuge 15-Mar-14 2:05am
I have updated my answer above.Please check that.
ntitish 15-Mar-14 2:14am
sir it is saying invalid source........
ntitish 15-Mar-14 2:14am
Sir below the video it is saying invalid sorce
Sampath Lokuge 15-Mar-14 2:16am
Do you have a folder structure as you mentioned above in your web solution ?
ntitish 15-Mar-14 2:18am
Yes sir....i given same path to media player it is working fine...
ntitish 15-Mar-14 2:18am
sir but if i given same path to media player it is playing the video.....if my path was wrong means it wont play in media player na sir..
Sampath Lokuge 15-Mar-14 2:25am
Are you test this on locally or IIS server ?
ntitish 15-Mar-14 2:27am
i am testing this on my local only sir.......
ntitish 15-Mar-14 2:29am
For example in this below link i just changed the

here also it working but in my web page it is not working......
Sampath Lokuge 15-Mar-14 2:31am
Check this one "../PtImages/Sravi-klokesh/Priorus-1394794109.mp4"
ntitish 15-Mar-14 2:46am
same error sir invalid source.......sir i am updating my question with two codes one is working but another is not working.....can u see that again if you dont mind...
Sampath Lokuge 15-Mar-14 2:55am
Yes,Your problem is you cannot access https url from the local host.For that you have to host your site on IIS (with ssl enabled).GOT MY POINT ?
ntitish 15-Mar-14 3:07am
but it is not playing the video which is in my project also na sir....and how it is playing in windows media player sir.
ntitish 15-Mar-14 3:39am
Sir it is working but how to bind url dynamically......i mean src
ntitish 15-Mar-14 3:48am
Sir r u there..........
Sampath Lokuge 15-Mar-14 4:21am
Sorry,I couldn't get what you told? Can I have more info ?
ntitish 15-Mar-14 4:54am
If you see the below link means u can get an idea sir,
ntitish 15-Mar-14 5:01am
sir did you got my point......
ntitish 15-Mar-14 7:39am
Sir i got one more problem .....the video which is taken by android mobile is not playing html5 video control but it is playing video taken by IPhone. here problem is both videos are in mp4 format there any solution for this.

the video not playing in html5 video control (the video taken by Android)

the video playing in html5 video control (the video taken by IPhone)
Sampath Lokuge 15-Mar-14 7:49am
Why can't you use working video only ? why do you need both ?
ntitish 15-Mar-14 8:13am
sir i want to play all the videos which is in my server so it is complsary to play the android mobile video thats why i am there any problem to play android mobile videos in html5 video control...
Sampath Lokuge 15-Mar-14 8:38am
Androids file format is different.It's *.m4v.Not *.mp4.Check that.
Sampath Lokuge 15-Mar-14 8:40am
Check this :

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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100