Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Bhavik Kama
How to use IFRAME IN POPUP window FOR PLAYING VIDEO
October 12, 2012 12:09 AM
Answer

Bhavik Kama

Rank: Junior Member

Posts: 55

Join Date: September 23, 2012

Recent Posts

Hi,

I have custom portlet which is adding videos to some cloud base server and i have embed url of that video in my datatable.so what i want to do is to open a popup window in that the video can be played on the preview button in list .

I have done with opening new window on preview button click with iframe.but want to play that video in some popup..my view.jsp as follows:-
 1
 2<%@page import="com.liferay.taglib.portletext.PreviewTag"%>
 3<%@page import="com.liferay.portal.kernel.portlet.LiferayWindowState"%>
 4<%@ include file="/init.jsp"%>
 5<%@page import="net.dmcloud.cloudkey.Test_FileUpload"%>
 6
 7 <%
 8ResultRow row = (ResultRow)request.getAttribute(WebKeys.SEARCH_CONTAINER_RESULT_ROW);
 9Video test = (Video)row.getObject();
10long groupId = themeDisplay.getLayout().getGroupId();
11String name = Video.class.getName();
12String adv_uId = String.valueOf(test.getPrimaryKey());
13String newPopup = "Liferay.test.displayPopup('previewProduct');";
14String otherPop = "showPopup()";
15%>
16
17<%
18Video testing=VideoLocalServiceUtil.getVideo(Long.parseLong(adv_uId));
19
20//Set Attribute which has all values of specified pk.
21   String vid_id=testing.getStream_url();
22   System.out.println("YOUR MEDIA ID IS :-"+vid_id);
23Test_FileUpload ts=new Test_FileUpload();
24String vid_url=ts.get_embed_url(vid_id);
25
26%>
27
28
29<iframe allowfullscreen="yes" title="PREVIEW" frameborder="0" height="100" style="width:200px" src="<%=vid_url %>"             width="100" allowscriptaccess="always"></iframe>
30
31
32
33
34 
35  <c:if
36    test="<%= permissionChecker.hasPermission(groupId, name,adv_uId,\"PREVIEW\") %>">
37    <portlet:actionURL name="previewProduct" var="previewURL">
38        <portlet:param name="adv_uId" value="<%=adv_uId%>" />
39       
40    </portlet:actionURL>
41     <liferay-ui:icon image="edit" message="PREVIEW" url="<%=previewURL.toString() %>"  /> 
42     <aui:button value="preiew" onClick="<%=otherPop%>" ></aui:button>
43
44[quote]/* on This input buttonclick i have to popup the iframe*/[/quote]
45
46<input type="button" value="Save"onClick="window.open('<%=vid_url %>','mywindow','width=100,height‌​=100,toolbar=no,resizable=no,menubar=no')" title="Click here to insert details" /> [/quote][/b]
47       
48       
49</c:if>
50
51   
52
53      
54      
55<script type="text/javascript">
56function showPopup() {
57      AUI().use('aui-dialog', 'aui-io', 'event', 'event-custom', function(A) {
58      
59        var dialog = new A.Dialog({
60                title: 'Popup Title',
61                centered: true,
62                draggable: true,
63                modal: true,
64                width: 600,
65                xy: ['center',10],
66
67               
68            }).plug(A.Plugin.IO, {uri: '/jsps/preview.jsp',}).render();
69         
70            dialog.show();
71         
72      });
73};
74
75</script>


I have created one java script as above with name of "function showPopup() "but whenever i try to give any URL or any page path ..its not showing any thing but just a blank popup with the "Failed to retrieve content" message.

So can anyone suggest me how to do this??
jaid shaik
RE: How to use IFRAME IN POPUP window FOR PLAYING VIDEO
October 12, 2012 5:00 AM
Answer

jaid shaik

Rank: Regular Member

Posts: 170

Join Date: October 7, 2010

Recent Posts

Hi Bhavik Kama,

I am also faced this...

 1 <link rel="stylesheet" type="text/css" href="/html/youtube/fancybox/jquery.fancybox-1.3.4.css" media="screen" />
 2 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
 3 <script type="text/javascript" src="/html/youtube/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
 4  <script type="text/javascript" src="/html/youtube/fancybox/video.js"></script>
 5<%
 6List<coursevedio> resource = coursevedioLocalServiceUtil.findBycoursefeatured("course");
 7String rvdio= resource.get(0).getCoursevideourl();
 8
 9String img = rvdio;
10 img = img.replace("http://www.", "http://img.");
11     img = img.replace("watch?v=", "vi/");       
12img =img +"/1.jpg";
13%>
14
15<div class="course_video_bigimg" id="content">
16                                           
17                                                <a class="video" title="The Falltape" href="<%=rvdio%>">
18                                                    <img src="<%=img%>"  alt="" width="277" height="219" />
19                                                </a>
20                                           
21                                            </div>


The above I am getting video URL from database and convert to image,
Then onclick of image open the popup box with video.

if you need script files, pls let me know.

I hope it helpful.

Thanks
Bhavik Kama
RE: How to use IFRAME IN POPUP window FOR PLAYING VIDEO
October 12, 2012 6:03 AM
Answer

Bhavik Kama

Rank: Junior Member

Posts: 55

Join Date: September 23, 2012

Recent Posts

Thanks for your reply..Actually can you explain how to make it possible?

I have seen your code u given here..but actually am new in this jsp and liferay too..so please if u can guide me in more explanatory way.

Thanks and Regards
Bhavik kama
jaid shaik
RE: How to use IFRAME IN POPUP window FOR PLAYING VIDEO
October 12, 2012 6:36 AM
Answer

jaid shaik

Rank: Regular Member

Posts: 170

Join Date: October 7, 2010

Recent Posts

Hi Bhavik Kama,

First I am getting video URL from Database
1<%
2List<coursevedio> resource = coursevedioLocalServiceUtil.findBycoursefeatured("course");
3String rvdio= resource.get(0).getCoursevideourl();
4%>


Second Getting Image from URL..
1 <%String img = rvdio;
2 img = img.replace("http://www.", "http://img.");
3     img = img.replace("watch?v=", "vi/");       
4img =img +"/1.jpg";
5%>


Third Displaying image with onclick video part.

1
2<div class="course_video_bigimg" id="content">
3                                           
4                                                <a class="video" title="The Falltape" href="<%=rvdio%>">
5                                                    <img src="<%=img%>"  alt="" width="277" height="219" />
6                                                </a>
7                                           
8                                            </div>


Here you need javascript,css files use Id="content" necessary.
Check the jquery plugin attached rar file From this rar you will get js,css files.


I tried my best way..

I hope it helpful to you.


Thanks
Attachments: youtube.rar (108.2k)
Bhavik Kama
RE: How to use IFRAME IN POPUP window FOR PLAYING VIDEO
October 13, 2012 3:33 AM
Answer

Bhavik Kama

Rank: Junior Member

Posts: 55

Join Date: September 23, 2012

Recent Posts

Thanks Man,

Very helpful and very neat and clean suggestion.let me try this.and i will give u feedback as soon as possible.

Regards
Bhavik Kama
Bhavik Kama
RE: How to use IFRAME IN POPUP window FOR PLAYING VIDEO
October 16, 2012 3:29 AM
Answer

Bhavik Kama

Rank: Junior Member

Posts: 55

Join Date: September 23, 2012

Recent Posts

Thanx for your reply,

But this thing not working in my liferay portal

<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/fancybox/jquery.fancybox-1.3.4.css" media="screen" />
<script type="text/javascript" src="<%=request.getContextPath()%>/fancybox/video.js"></script>
</head>
<body>
<div class="course_video_bigimg" id="content">



<a class="video" href="<%=vid_url %>">PREVIEW</a>



</div>


</body>
</html>


This is my page where the link is given as u suggested
have put these j query which is required..still when i click on preview its just redirect the browser to linked URL