Video auto played in display none div - google-chrome

I have vide an iframe with video that needs to be played in fancybox.
Here is the code:
<a id="playLink" href="#pageVideo">Link for video </a>
<div style="display:none">
<div id="pageVideo">
<iframe src="someVideo.mp4?autoplay=true" style="overflow:auto" frameborder="0" height="400" width="650"></iframe></div>
</div>
$('#homePlayLink').fancybox({
'padding' : 0,
'width' : 560,
'height' : 400
});
The problem is that in Chrome video starts to play on page load. Because it is in display none div I do not see it but I hear the audio. How to fix this, so the video plays only in fancy box After click on the link?
Thanks.

Your iframe src has the autoplay = true parameter; this is why it will auto play when the page loads.
How about pointing the iframe src to a blank page and then override the href when the fancybox opens?
$("#tip4").click(function() {
$.fancybox({
'padding' : 0,
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'title' : this.title,
'width' : 680,
'height' : 495,
'href' : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
'type' : 'swf',
'swf' : {
'wmode' : 'transparent',
'allowfullscreen' : 'true'
}
});
return false;
});
Take a look at http://fancybox.net/blog section 4: Show youtube clips.

Related

change the back background Color of Textareafield

i cant change the backgroundColor of Textareafield In EXT js4.2
css
.disable-field{
background: #b5b8c8 !important;
}
Js
var remaskTextField = Ext.create('Ext.panel.Panel', {
id : 'remasksTextField',
title: 'Remark',
items: [ {
id : 'remask',
xtype : 'textareafield',
name : 'message',
width: 310,
height:230
}]
});
i tried the following code to change colour .
only the first one can change the backgroundColor but the top line of the Textareafield still remaining unchanged .
document.getElementById('remaskTextField').style.backgroundColor = "#c3c5ce";
Ext.getCmp('remask').addClass('disable-field');
Ext.getCmp('remasksTextField').addClass('disable-field');
One approach, that worked for me with ExtJS 4.2, is fieldStyle config:
fieldStyle : String
Optional CSS style(s) to be applied to the field input element. Should
be a valid argument to Ext.Element.applyStyles. Defaults to undefined.
See also the setFieldStyle method for changing the style after
initialization.
Example:
Ext.onReady(function() {
Ext.create('Ext.form.TextArea', {
renderTo: Ext.getBody(),
width: 400,
height: 400,
fieldStyle: "background: #b5b8c8 none repeat scroll 0 0 !important;"
});
});

How do we display a view in ExtJS using browser's console

Is there any way to display our view without creating any button clicks events in controller
Console view
give your view xtype and id to the Viewport items and then paste the code into the console
Ext.Viewport.add({
xtype : 'panel',
itemId : 'testingOverlay',
showAnimation : {
type : 'popIn',
duration : 250,
easing : 'ease-out'
},
hideAnimation : {
type : 'popOut',
duration : 250,
easing : 'ease-out'
},
height : '630px',
width : '335px',
left : '210px',
top : '205px',
items : [{
xtype : 'viewXtype',
id : 'viewId'
}],
});
You can also use renderTo property, if you specify renderTo:Ext.getBody() it will render the content or replace Ext.getBody() with html element.
But in real applications you will need a viewport this is better than renderTo
Fiddle Sample Code
Ext.create('Ext.panel.Panel',{
title:'Test Panel',
width:400,
height:500,
renderTo:Ext.getBody()
});

Embedding youtube video

I embed youtube video in my website like this:
<iframe width="320" height="180" src="http://www.youtube.com/embed/12345678"
style="border: none" allowfullscreen id="myVideo"></iframe>
This iframe's href downloads a this which is 2.7 KB
That download these:
287 KB http://s.ytimg.com/yts/swfbin/watch_as3-vf123456.swf
40.4 KB http://s.ytimg.com/yts/jsbin/www-embed-vf123456.js
26.7 KB http://s.ytimg.com/yts/cssbin/www-embed-webp-vf123456.css
0.5 KB http://i3.ytimg.com/crossdomain.xml
So even though the user didn't watch video yet, he downloads nearly 356 KB data. What would be a better way to show Youtube video in my website but load these data when user wants to watch video ?
You can use the thumbnails and only load the player when the user clicks the thumbnail
You can see an example of how to do this using AngularJS on the Topic Explorer example
App:
https://yt-topic-explorer.googlecode.com/git/dist/index.html
View:
https://code.google.com/p/yt-topic-explorer/source/browse/app/views/main.html
Code snippet:
<div class="player-container">
<img ng-click="videoClicked($event.target, videoResult.id)" ng-src="{{videoResult.thumbnailUrl}}" class="thumbnail-image">
<div class="title"><a ng-href="{{videoResult.href}}" target="_blank">{{videoResult.title}}</a></div>
</div>
Controller:
https://code.google.com/p/yt-topic-explorer/source/browse/app/scripts/controllers/main.js
Code snippet:
function playVideo(container, videoId) {
var width = container.offsetWidth;
var height = container.offsetHeight;
new YT.Player(container, {
videoId: videoId,
width: width,
height: height,
playerVars: {
autoplay: 1,
controls: 2,
modestbranding: 1,
rel: 0,
showInfo: 0
}
});

tinymce html5 editor

I used tinymce(3.5.8 version) editor as html5 editor. Now i want features to add video and audio tags.
function doTinyMCECleanUp(frm, id)
{
var c = frm[id].value;
c = c.replace(/ </source>/gim, '');
c = c.replace(/</source>/gim, '');
// comment this out if 'html' not 'xhtml'
c = c.replace(/]*)>/gim, '');
frm[id].value = c;
}
tinyMCE.init({
mode : "textareas",
theme : "advanced",
plugins : "visualblocks,inlinepopups,mediahtml5,media",
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,styleselect,justifyleft,justifycenter,justifyright,justifyfull,|,visualblocks,code,mediahtml5,media",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
content_css : "/js/tinymce/examples/css/content.css",
visualblocks_default_state: true,
extended_valid_elements : "video[*]",
// Schema is HTML5 instead of default HTML4
schema: "html5",
template_external_list_url : "tinymce/examples/lists/template_list.js",
external_link_list_url : "tinymce/examples/lists/link_list.js",
external_image_list_url : "tinymce/examples/lists/image_list.js",
media_external_list_url : "tinymce/examples/lists/media_list.js",
// End container block element when pressing enter inside an empty block
end_container_on_empty_block: true,
// HTML5 formats
style_formats : [
{title : 'h1', block : 'h1'},
{title : 'h2', block : 'h2'},
{title : 'h3', block : 'h3'},
{title : 'h4', block : 'h4'},
{title : 'h5', block : 'h5'},
{title : 'h6', block : 'h6'},
{title : 'p', block : 'p'},
{title : 'div', block : 'div'},
{title : 'pre', block : 'pre'},
{title : 'section', block : 'section', wrapper: true, merge_siblings: false},
{title : 'article', block : 'article', wrapper: true, merge_siblings: false},
{title : 'blockquote', block : 'blockquote', wrapper: true},
{title : 'hgroup', block : 'hgroup', wrapper: true},
{title : 'aside', block : 'aside', wrapper: true},
{title : 'figure', block : 'figure', wrapper: true}
],
setup : function(ed) {
ed.onSubmit.add(function(ed, e) {
doTinyMCECleanUp(e.target, ed.id);
});
},
});
I tried a lots with 2 plugin mediahtml5 and media.
When i use media plugin. If i add video tags it insert flashobject with video tags.
And also when i update the content video tags goes out. I can't see it anywhere any html source editor. i can see only flash object source.
when i use mediahtml5 plugin i can add videos into editor but can not see into html view source editor.
Can anybody please help me .
Have a look at the tinymce settings valid_elements and valid_children.
Tinymce stips out html tags that do not match the configuration/ are invalid.
Add the 'extend_valid_elements' to your tiny mce initalization. For example:
$('#my_textarea').tinymce({
...
extended_valid_elements: "audio[id|class|src|type|controls]",
...
})
The example above allows you to insert 'audio' tags with the desired element properties in the tiny mce editor.
Note: I use tiny mce jquery plugin but it's the same thing for the regular tiny mce.

Panel overlay in Sencha touch 2

I have been working on an application using sencha touch 2 .
I have a toolbar on top which contains a button .
When i click this button i will have a panel overlay .
In this panel,i want to have two items :
var shareButton = {
xtype : 'button',
ui: 'action',
width:'36px',
height:'36px',
handler : function(){
var panel=Ext.create('Ext.Panel',{
right: 0,
top: 20,
modal: true,
hideOnMaskTap: true,
hidden: true,
width: 260,
height:'70%' ,
styleHtmlContent: true,
scrollable: true,
items: [
{html:'Tweet</body>',},
{html:'<div ><class="fb-like" data-href="http://test.com" data-send="false" data-layout="button_count" data-width="4" data-show-faces="false"></div>'}]});
Ext.Viewport.add(panel);
panel.show();}};
But this is not working.
In fact,i want the first one to direct me to twitter to share the URL (www.google.com).
And the second one to facebook to share "test.com".
Unfortunately ,nothing is displayed in the panel .
Thank you.
Since the overlay is called after the page is loaded, the facebook and twitter buttons should rendered again
This is the code that should be added after the overlay is shown
FB.XFBML.parse();//facebook
$.ajax({ url: 'http://platform.twitter.com/widgets.js', dataType: 'script', cache:true}); //twitter
This works for me. THe only problem is that the Facebook like button has not got a size, so you cannot see it.
Ensure your floating panel is not scrollable. If it is scrollable, give it a fixed width and height.
Update
Here is an example on Sencha Fiddle: http://www.senchafiddle.com/#jgXtj
Ensure you are adding the panel into Ext.Viewport.