File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes play videos using jsp problem? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "play videos using jsp problem?" Watch "play videos using jsp problem?" New topic
Author

play videos using jsp problem?

Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2
hiii can anyone tell me how can i play videos in my website,using jsp or just like youtube...??
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

This is not anything to do with JSP. You'd just use the appropriate HTML markup.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2
yes actually i did it using html and jsp,
i was putting the embed tag into anchor tag.
and i was taking element Id using Jsp Request and playing that video in my other div, but i don't know why but my embed tags are not working,
i just jst need to knw is there any other way to do this, or m i going wrong??
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

Again, all this happens on the client side, so I don't see what the JSP dimension is yet. Perhaps if you were to post the non-working code, someone could comment on it.
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2
here is my code, but it's not working..


Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

Have you examined what's sent to the browser to make sure that the JSP evaluation produces why you expect?
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2
browser is getting value of 'vname' variable.
and vname is passed as the video name..
please correct me if i m wrong..
Albareto McKenzie
Ranch Hand

Joined: Apr 08, 2009
Posts: 298
Yes, but are you getting the expected value there or are you getting just a null or other strange thing?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

I have no idea. I don't use video. The JSP source isn't likely to be helpful. Post (properly indented and formatted and using code tags) what's being sent to the client and perhaps somebody that's familiar with vide can spot a problem.
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2
i m facing a problem while i am playing video using jsp on click of anchor tag..
here is my code....



can anyone tell me what i am doing wrong here..?

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

As I said, posting the JSP source is not helpful! That is not what the browser will see. If you want help, you're going to have put some effort into this.

Post the code as sent to the browser. That's what the browser is seeing and what is not working.
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2
this is the code my browser is producing;



Is this what you are asking for.
i apologies if i m not getting you.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

Yes, that does help because it shows that the value of the src attribute is suspect. It's specific as page-relative, and that frequently causes problems in web applications.

I would change it to a server-relative URL that begins with the context path and see if that helps.
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2
how can i change it can you tell me..?
Gopakumar Naryanan
Ranch Hand

Joined: Jan 15, 2011
Posts: 72

Try replacing the href of <a> with bold highlighted code below:



with ${pageContext.request.contextPath}/video_name=video.wmv

(I guess Bear also wanted to tell the same. am i right bear?)


Thanks & Regards
Gopakumar
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2
sorry i m not getting, i don't know abut expression language, i tried like this:

Click to play ${pageContext.request.contextPath}/video_name=video.wmv
<% String vname=null;
vname=request.getParameter("video_name");
%>

isn't it??
Gopakumar Naryanan
Ranch Hand

Joined: Jan 15, 2011
Posts: 72

That's ok.



instead of "index.jsp" substitute value of "path" over there.
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2
is the code is like this??



Here i m getting an error after clicking to the link...
Gopakumar Naryanan
Ranch Hand

Joined: Jan 15, 2011
Posts: 72

Can you please post the Error Details?
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2
this is the error:

HTTP Status 404 - /video/video_name=video.wmv

type Status report

message /video/video_name=video.wmv

description The requested resource (/video/video_name=video.wmv) is not available.
Apache Tomcat/7.0.11

But my video is in my project...
but it'd not in the separate folder, should i separate it..?
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2
i seperated it into a new folder, now the error is removed but nothing i m getting after clicking....
Gopakumar Naryanan
Ranch Hand

Joined: Jan 15, 2011
Posts: 72

prior to making the above change , what was the error you were getting?

I didn't understand why you are using vname variable?
You can't get the request parameter in the form itself.(vname would be always null in this case)

By the way when you click the hyperlink where does the request go?

Can you explain a bit clear?
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2
okay, here is my new code:



whenever i m clicking it will go to my video folder in my project and check for video.wmv.
Although i used request.getParameter, because i want to play videos like youtube, therefore i would add more videos and take the parameter and play those videos..\
Hope you get what i want to say..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

Until you fix the URL, you will continue to have problems.
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2
which URL problem bear, could you please explain, still i m not getting you..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

I repeat:
Bear Bibeault wrote:Yes, that does help because it shows that the value of the src attribute is suspect. It's specific as page-relative, and that frequently causes problems in web applications.

I would change it to a server-relative URL that begins with the context path and see if that helps.
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2
okay, i changed my src like this:




Is this bear what you are saying...
But still it's not working..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

Does the generated URL work when your type it into the browser?
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2
no it's not working bear...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

Then you need to find out what the appropriate URL needs to be. Anything else is a wast of time. Until you can figure out how to properly address the video, writing code to do so will fail.
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 1001
    
    2
okay..
Thank You..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: play videos using jsp problem?