Google Swiffy multiple movies on one page - google-swiffy

I'm trying to create multiple swiffy.Stage() movies on one page.
But it seems that when there are multiple Flash movies on a page, only one of the movies will actually run as it should. I have to call their stage.tick functions manually.
EDIT: With multiple sound containing flash, only one will play correctly.
EDIT:
The expected behavior is that "tick()" is handled by the Swiffy runtime after running "start()". Unfortunately it seems that the Swiffy runtime will only handle the tick function for one movie per page.

Found that the issue was not multiple movies, but that some of the movies were not on the screen or invisible, and so were not being rendered by Chrome. It seems that Chrome optimizes away draws that aren't visible.

Related

How to prevent rendering artifacts in PDFKit/NSImage?

I'm trying to create a tool to rasterise vector images—stored in PDF files—on macOS, but the resulting images contain artifacts around the edges of some shapes. Preview.app, on the other hand, always renders the PDF flawlessly, as shown in this example:
I've tried:
Loading the PDF document using PDFKit, and rendering the page using both draw(with:to:) and thumbnail(of:for:)
Loading the PDF document into an NSImage (which creates an NSPDFImageRep), and using cgImage(forProposedRect:context:hints:)
In both cases I get these aliasing-like artifacts as seen on the left-hand-side of the image above. The PDF file is out of my control, so can't be changed to fix any issues it might have. I'm currently trying to migrate away from Cairo (which renders correctly) to Apple's PDF rendering for performance reasons (PDFKit renders it much more quickly, albeit with these artifacts).
Is there anything I've missed which would fix the output?
So it looks like the issue was caused due to me rasterising PDFs on multiple threads (specifically my tool rasterises PDFs in multiple resolutions, so I thought why not simultaneously).
Performing the operations sequentially on the main thread instead fixed it. I thought that I had come up with a way to use it concurrently by initialising the CGContext manually (instead of using NSImage's lockFocus()/unlockFocus() and NSGraphicsContext.current), but alas, as I soon as I add a context.scaleBy (to generate the images at different sizes), it fails again.
So for now I'm just doing it on the main thread until another solution comes along.

How is this background video implemented without showing up in the HTML source or the console resources/network tabs? [LINK]

If you go here (link: https://yle.fi/uutiset/3-11555155) and scroll down this news article, you will see there is a rather long background video that plays as you scroll showcasing some nodes and boxes. However the initial page load is very fast and I don't see it loading a video from anywhere at all.
As I try to understand how this website is put together, I'm not able to see where the video comes from, nor do I know if it's an .mp4 or some other format. When I try to hunt it down in my network tab and monitor if it loads, I just cannot see it and there is no resource that seems to be more than a couple of hundred kilobytes.
How is this possible from a web-design standpoint? Is it some sort of a proprietary solution that stealthily streams the video as it is loaded? If I would like to build a background video that plays on scroll like this in such a performant manner, how could I do it?
Such videos that play on scroll can often be seen for example on the apple.com website, but at least there I can easily also see the original source videos and materials of how the page is put together. Here this is not the case.
I would greatly appreciate if you could answer this super basic question I have. Thank you!

SVG loaded via objects all jumbled up

So this is an interesting one. I did a test of using the clown car technique for showing responsive images via svgs loaded via an object tag because I really like the approach.
Now this works all fine, except when you have a few of them on one page with the cache normally activated, you leave the site to go to anywhere else in the interwebs and then press the back button - suddenly all images are mixed up, even though the code is still correct, ie:
object 1 loads svg that shows image from object 3
object 3 loads svg that shows image from object 5
etc.
Totally random and I just can't explain how this can happen. And it only ever happens when I go back to the page via the back command of the browser (chrome).
Has anyone experienced anything like this before??
I guess I'll stick to good old normal images for now...
Just ran into the same bug. And so did Google!
I suppose we'll have to use inline SVGs as loading through <img> tags aren't a possibility for me.
If you only have a single page app, you could add target="_blank" to your <a> tags to ensure the back button will come into play far less.

Embedded youtube video with "autoplay=1". Does it count towards views?

I can cause an embed youtube video to begin playing automatically using "autoplay=1"
When a user views the embedded video does it count towards my views count?
I have attempted to test but had inconclusive results. Viewed embedded videos to not appear to consistently convert to views even when play is manually clicked.
My tests have been from a single machine and IP which may be the problem? Browser session does not seem to be relevant.
There's been some discussions regarding this topic. Here's a thread with some contradictory answers:
Does the views in the embed player count?
And here's an article about an official response from Youtube claiming that autoplay views does not count:
Youtube Says Autoplay Don't Count
Here's another one that claims that embedded videos with autoplay doesn't count:
How does YouTube video view count work?
(found through this SO answer)
Note 1: Note that there seems to exist "cheats" and bugs, but Youtube claims to be working to prevent it. This means that, if you're using their API in a regular way, your autoplay views probably doesn't count.
Note 2: The above note is simply Youtube's official statement. Who knows what's really going on. Some people (including you, OP) are getting mixed results.
The bottom line is, don't count on it (pun intended).
Short answer: NO
I found this official documentation on the subject (however it's regarding the Custom gadget development guidelines)
Rule of Thumb:
Any time a user initiates a playback using the native player controls, that playback should count. Using an API method to PLAY a video does not count. BUT, you can use cueVideoById and then have the user click a native built in play button and it will count.
Views will NOT be counted if:
The user initiates playback via an API method like playVideo or loadVideoById
The video autoplays via the autoplay parameter
You can try adding the attribute "enablejsapi=1" . This will increase the view count in youtube.com site
No. It was a long search, but the answer seems to be hidden here. Follow the link to check it out.
Taken from here.
https://support.google.com/youtube/answer/171780?hl=en&ref_topic=3014330

Video Background/ Chrome browser only shows video when user clicks on screen?

I am using a video background plugin on this site http://kimcolemanprojects.com/index.html
Its works great on all browsers, only on chrome the video doesn't show until the user clicks on the screen, which is just a white screen.
Looks like its bound to a click event but I can not work out where. I can see no events bound to this page.
Thanks for your help.
Angela
This is a strange one indeed. It only happens for me when I open your site in a background tab. There are definitely no click handlers. (See "Event Listener Breakpoints" in dev tools.) And the video element does exist and is loaded, even though it's not displaying. So I suspect it's either a bug in Chrome or a quirk in how it handles certain slow-loading pages.
One thing that seems to make it show up is to tweak the CSS in the developer tools. So try adding this to your page at the end of the body element:
<script>
$(document).ready(function() {
setTimeout(function() {
document.getElementsByTagName('video')[0].style.display = '';
}, 500);
});
</script>
That works for me when I run it in the console, so hopefully it will work in script.
Also, there are a few easy things you can do to make the page load much faster and mitigate this particular problem, even if you can't make it go away completely.
Set a dark background color. That way, when the video takes some time to load, people will be able to see the white text immediately.
Make the video MUCH smaller. It's about 21MB, which is way too big for a background. It's encoded at around 3400kb per second, which is more than you need even for HD video on the web. Try it at 1000kb or even less. Maybe 500kb. And don't include an audio track in the video file.
Save the poster image as a jpg instead of png. It's 140kb. You can get it much smaller.
Put all your scripts (except for the mobile redirect) at the bottom of the body tag. This way you can at least get the text and background color displaying without having to load your scripts.

Resources