Clicking HTML 5 Video element to play, pause video, breaks play button

The simplest form is to use the onclick listener: <video height=”auto” controls=”controls” preload=”none” onclick=”this.play()”> <source type=”video/mp4″ src=”vid.mp4″> </video> No jQuery or complicated Javascript code needed. Play/Pause can be done with onclick=”this.paused ? this.play() : this.pause();”. To keep it from clashing with the video controls on some browsers, call preventDefault on the click event: onclick=”this.paused ? … Read more

Embed HTML5 YouTube video without iframe?

Here is a example of embedding without an iFrame: <div style=”width: 560px; height: 315px; float: none; clear: both; margin: 2px auto;”> <embed src=”https://www.youtube.com/embed/J—aiyznGQ?autohide=1&autoplay=1″ wmode=”transparent” type=”video/mp4″ width=”100%” height=”100%” allow=”autoplay; encrypted-media; picture-in-picture” allowfullscreen title=”Keyboard Cat” > </div> compare to regular iframe “embed” code from YouTube: <iframe width=”560″ height=”315″ src=”https://www.youtube.com/embed/J—aiyznGQ?autoplay=1″ frameborder=”0″ allow=”accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture” allowfullscreen> </iframe> … Read more

How to play YouTube content on tvOS

UIWebView and MPMoviePlayerController are not available for tvOS. Our next option is to use AVPlayer to play YouTube videos. AVPlayer cannot play a YouTube video from a standard YouTube URL, ie. https://www.youtube.com/watch?v=8To-6VIJZRE. It needs a direct URL to the video file. Using HCYoutubeParser we can accomplish exactly that. Once we have the URL we need, … Read more

How to receive NSNotifications from UIWebView embedded YouTube video playback

There are no documented notifications sent by the UIWebView embedded movie player. In fact, the closed implementation used within the UIWebView does differ from the public MPMoviePlayerController in many aspects (e.g. DRM). The most important classes used for playing video content within that UIWebView are called MPAVController and UIMoviePlayerController. The latter one makes the player … Read more

Force youtube embed to start in 720p

(This answer was updated, as the previous method using vq isn’t recognized anymore.) Specifying the height of the video will change the quality accordingly. example for html 5; <iframe style=”width:100%; height:800px;” src=”https://www.youtube.com/embed/xxxxxxxx”></iframe> If you don’t want to hardcode the width and height you can add a class to the iframe for css media queries. Tested … Read more

URL sanitization is causing refresh of the embedded YouTube video

Figured it out. For anyone interested. The problem was the use of this function in my html [src]=”getTrustedYouTubeUrl(item)” The reload side effect was gone once I changed the code to calculate the safe url when the data is loaded in my service and changed the iframe binding to this <iframe [src]=”item.video.safeUrl” scrolling=”no” frameborder=”0″ allowfullscreen></iframe> Note … Read more

How to get a YouTube thumbnail from a YouTube iframe?

YouTube thumbnails YouTube thumbnails can be found in this standard path: http://img.youtube.com/vi/[video-id]/[thumbnail-number].jpg [video-id] is the YouTube video ID, e.g. 1sIWez9HAbA. [thumbnail-number] is the number of the thumbnail of the 4 each video usually has, e.g. 0. Getting the thumbnail from an iframe So, based on the iframe‘s src attribute you may construct the URL of … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)