Any idea how to disable auto play on embedded "Vine.co" videos? - javascript

I'm working on a little side project.
I'm able to embed and display specified vine.co video's with
<iframe id='eFrame' src='http://vine.co/v/bJjdTLBnwx1/card' width='380' height='380' frameborder='0'></iframe>
I'm pulling in the links via Ajax to display them on the page, however now the problem is they are all autoplaying, which causes major browser lag.
Anyone know how I can append them to the body with autoplay disabled? This project is all client side, so I'll be limited to client-side languages. (ie Javascript/jQuery etc..)
Much appreciated, Cheers.

I'm probably late but you can pass some command via the postMessage javascript's function. It worked for me :
var iframe = document.getElementById(id);
iframe.contentWindow.postMessage('pause', '*');
Same construction for play, mute and unmute.

<iframe id='eFrame' src='http://vine.co/v/bJjdTLBnwx1/embed/simple' width='320' height='320' frameborder='0'></iframe>
Try this it will be of much help have better controls and only on pressing the play button it will run.
Try it.

Related

How to change iframe source

the issue is that I'm trying to develop a web site and I'm using Google Web Design. So far so good. I've inserted an iFrame and I want to change it's source when I'm pressing a button. Every search that I've googled speaks about "src" but my iFrame has "source" attribute. I've tried almost every solution that I found but I gave up. It may be a stupid question but how am I supposed to do it? I've used "document.getElementById("myId")" or "window.frames['id']"... Not a chance. Anyone have an idea? Thanks a lot.
<iframe is="gwd-iframe" id="textToShow" source="" class="gwd-iframe-15nv gwd-gen-mv4zgwdanimation" style="background-image: none;" scrolling="auto">
</iframe>
gwd.goOnTheWeb = function(event) {
//should be in here
};
Please take a look into Google Web Designer Help > The iFrame component.
After some researches I've managed it. Finally, in Google Web Design there is an option in the right-click -> Add event... on an imageButton, called iFrame, that allows you to load an external page into an iframe. On the other hand, hopefully, I've found that somehow the "source" attribute of an iframe that the software writes automatically in code (I'm using OS X), is about to "guide" Safari while "src" is for browsing on Windows. Excuse me, please if I'm kind of "out-of-topic" but even being in IT, I've never developed a site since. So, have mercy. :)
myBtn.onclick = function() {
var filepath = 'video/hollywood-movies-2.mp4';
document.getElementById('textToShow').src = filepath ;
}

Deactivate/removing an iframe using javascript

I have more than 15 thumbnail images displayed(fetched from DB and looped) on the webpage. Onclick of an image, I have an overlay which plays the youtube video(iframe version).
The problem is that, on closing the overlay, the youtube video continues to play.
After going through the YT documentation, I figured out that there is no way to control the YTplayer inside an iframe. But, I have to use an iframe because embed and object tags make use of flash and flash is not supported in Mac(Mountain Lion)
So, I was thinking, if there is a way to deactivate iframe then the player may stop. display:none; does not help.
Please suggest.
Thanks in advance.
I tried this method and it works:
I fetch the iframe source by id using javascript and make the source blank.
<script>
function stopVideo(){
document.getElementById("iframeID").src= "";
}
</script>

Is it possible to play a quick chime in website without a plugin (no Flash or Quicktime)?

I have a single page web app that shows real time data using just HTML/CSS/JS - I have managed to keep Flash out of it.
Now I want to play a small chime but I don't want to make the site dependent on Flash. It is just a chime to indicate a new chat, so it is not a huge stumbling block but I would like to find a way.
Is this possible - I am guessing no since you need something local to play the sound, but I am hoping here!
Thanks in advance for any help!
Edit: I am not able to use HTML5 quite yet.
Check out the HTML5 audio framework buzz or MediaElement.JS
Playing .wav files embedded in html? Try Different ways to play sound from a website - UCL
Example two of this web page shows a good example. An easier version of this example would be this...
function playSound(soundfile) {
document.getElementById("sound_element").innerHTML=
"<embed src='"+soundfile+"' hidden=true autostart=true loop=false/>";
}
The HTML would be this...
<span id="sound_element"></span>
This puts a hidden embedded file in the web page. You can call this function by doing playSound(Path/To/File)

Get YouTube Audio URL on iOS

I am using this javascript code to get a downloadable video URL from the mobile youtube website.
[webView stringByEvaluatingJavaScriptFromString:#"function getURL() {var player = document.getElementById('player'); var video = player.getElementsByTagName('video')[0]; return video.getAttribute('src');} getURL();"];
Output URL: http://o-o.preferred.seabone-mil1.v22.nonxt2.c.youtube.com/videoplayback?el=results&begin=0&yms=5682703339584930992&itag=18&ip=87.0.0.0&app=youtube_mobile&signature=B8CD6B60D2609F5F137B885806F8FAECAA88492F.333D3F19876A77CECB264059A3852BD021401296&sparams=id%2Cexpire%2Cip%2Cipbits%2Citag%2Csource%2Cratebypass%2Ccp&len=254000&ratebypass=yes&source=youtube&expire=1323579819&sver=3&key=yt1&ipbits=8&cp=U0hRSFVSV19GU0NOMV9NTEFJOmV5Qk5wc3hWaUxG&id=b8e73777013e0b7e&ps=blazer
I would like to do the same with just the audio of the video. But i haven't succeeded yet. Can anyone help me?
I solved it! I use the youtube-mp3.org api which works really good. there are some questions about it on SO with good answers!
It's going to be difficult to extract the audio only portions from an existing video from within iOS. I'm sure there are libs out there that can help, but I think it's going to be an involved topic.
Perhaps you can take a look at Display YouTube Videos Without Exiting Your Application. It describes ways to play youtube videos from within your iOS application. Now if you do something similar but set the view to be hidden, you would be able to "listen" to the youtube videos's audio without showing the video itself on the screen.
I don't know what the end-goal is for you're application, but perhaps my suggestion will be food-for-thought.

Does JavaScript have to be enabled to play embedded video?

In order to view an embedded video on a web-page, is it absolutely necessary to have javascript
enabled - assuming the web page is not in the latest HTML5 format and hence has none of
the newer type tags?
I have noticed that YouTube does not work with JS disabled and I was wondering
whether it was a conscious decision on YouTube's part to work only with JS enabled or
did they really have no choice.
The embed code for YouTube is basically an iframe that links to a normal HTML page that uses JavaScript to load in the video you want to see.
In general, you can view video without JavaScript enabled. Most videos are played through Flash, which you can include directly into your page with either an object tag or an embed tag.
There are libraries, such as SWFObject that will put those players into your page for you, but do so through the use of JavaScript. If you want to use a library like that, you will need JavaScript enabled.
Also, if your browser does support HTML5, you can load video directly into the page with the video tag, without the need of JavaScript.
Youtube wants you to have Javascript enabled to deliver advertising.
The player you want to use to embedd the video will tell you if Javascript has to be enabled or not.
Most of the Flash based players work without Javascript enabled, some other don't.
If you are going to embedd a QuickTime video, you don't need to have Javascript enabled to play it

Categories