Video with GPUImageChromaKeyFilter has tint when played in transparent GPUImageView?
I got this working. The solution is to use GPUImageChromaKeyBlendFilter.
It blends two sources by replacing the pixels of the colour specified in setColorToReplaceRed in the first source with the pixels in the second source.
So I made a GPUImagePicture with a transparent UIImage and added the filter as a target to it. You can use a transparent PNG or build an UIImage and fill it with transparent in code (empty UIImage won't work!)
Now everything works beautifully!
The code is
let filter = GPUImageChromaKeyBlendFilter()
filter.setColorToReplaceRed(0, green: 1, blue: 0)
let movieFile = GPUImageMovie(URL: url)
movieFile.addTarget(filter)
let backgroundImage = UIImage(named: "MTransparent")
let sourcePicture = GPUImagePicture(image: backgroundImage, smoothlyScaleOutput: true)
sourcePicture.addTarget(filter)
sourcePicture.processImage()
let playerView = GPUImageView()
playerView.backgroundColor = UIColor.clearColor()
filter.addTarget(playerView)
movieFile.startProcessing()
Play video with transparent background IOS
Here is a link with a real solution to this problem playing-movies-with-an-alpha-channel-on-the-ipad. Her blog post is talking about video on the iPad, but the same library with alpha channel support also works on iPhone. It is also possible to encode to h.264 with alpha channel support using the method described in the blog post comments.
Play video with alpha channel in iOS?
It looks like there's no way to do this with iOS provided solutions. But according to this answer to a similar question you might succeed with ffmpeg. The problem with ffmpeg is that GPL/LGPL are incompatible with Apple's terms so you can't use it in an app for the App Store.
Does getElementById work on elements created by javascript?
To answer your main question: document.getElementById
does work with dynamically added elements.
In your sample code you are creating the openMonth div and setting its innerHTML. Then in the remove tag you are doing this:
var month = openMonth.getElementsByTagName("span")[0].innerHTML;
openMonth.getElementsByTagName("span")
will not exist and will get an error because there are no span elements. I don't know if this is a mistake in the code or if it is just a incomplete sample in the post.
Related Topics
How to Change the Number of Decimal Places iOS
Can't Set Calayer's Border Color
Delete Image from Photo Gallery
Horizontal Paging Uicollectionview with Automatic Item Size in a Vertical Stack View
Increment Tab Bar Badge W/ Uialertaction Swift
Programmatically Obtaining the Imei or Udid of an iOS Device
Swift - How to Open Another Viewcontroller with Collectionviewcell Inside Uitableviewcell
Uitableviewcell Shows Incorrect Results from Document Folder
How to Update iOS 14 Widget Background Color from the App
Countdown with Several Decimal Slots, Using Nstimer in Swift
Updating Label Takes Too Long (Swift)
Random Number from an Array Without Repeating the Same Number Twice in a Row
Sirikit, How to Display Response for Start Workout Intent