I'm trying to add a text transcription of a spoken audio file with the track tag. The default behavior for the video tag is to display them (works). By default the audio tag seems to lack some sort of 'canvas' (the black area a video tag displays even without video) to display the subtitles automatically. I could use the video tag but it would feel like a ugly workaround. I don't want to break the semantics of my code though.
Is there some kind of CSS to force the display of such area where the subtiles will be displayed?
<audio controls>
<source src="test.ogg" type="audio/ogg">
<source src="test.mp3" type="audio/mpeg">
<track kind="subtitles" label="English subtitles" src="/test.vtt" srclang="en" default></track>
Your browser does not support the audio tag.
</audio>
Thanks you for reading.
I've tested this out without jquery -- as taylor-newton mentioned, you'll need to create a tag for your text to appear in.
document.getElementById('my-audio-player').textTracks[0].addEventListener('cuechange', function() {
document.getElementById('my-subtitle-display').innerText = this.activeCues[0].text;
});
This does work with subtitles from audio tags too and using kind="subtitles" in your track tag works with audio as well.
I don't know how to do this with just CSS, but I have done something similar (custom cues) with video text tracks and JavaScript. Hopefully you should be able to leverage the same TextTrack events to accomplish what you are wanting to do with audio tracks.
You can bind a custom function to the track's oncuechange event, and then use the track's activeCues to generate your own captions. This custom div can then be positioned or styled however you want.
This should grab the text track and get the text from the currently active cue every time a cue change occurs.
$('audio')[0].textTracks[0].oncuechange = function() {
var currentCue = this.activeCues[0].text;
$('#yourCustomCaptions').html(currentCue);
}
Then take the text from each cue and inject it into the custom div you want to display.
https://developer.mozilla.org/en-US/docs/Web/API/TextTrack
I have a similar requirement trying to build a captions transcript display for audio logs for a personal app. I am trying to auto scroll and highlight the text phrases based on the audio log. I did not find the element displaying .vtt file captions set on element as there is no canvas available similar to video element. And decided to write a custom canvas component to display associated .vtt on the container and found this HTML5 Video Caption maker demo handy, you can give it a shot.
There is a pseudo-element in html that you can select it in css to style your subtitle or caption .
It is ::cue element that you can give some css property like color, opacity, font and etc . You see all of them are the styles that used for texts .
I learned these when I learned how to use video tags . But had a search in google and found a very helpful article on MDN . You can see everything about subtitle styling in here .
And there is no reason to use plugins ;) .
Related
I inherited a WordPress plugin that sends an RSS feed of content to Mailchimp to generate an email. This code (which I cannot find the source) is adding an extra logo image which is throwing off the formatting. I know I should add something like
<!--[if !mso 9]><!-->
to the code if I want to hide it in Outlook, but I cannot find the source to add this. I can only add external CSS. The usual display: none works in the other email platforms. Any advice on how to remove this extra image instance in Outlook via external CSS?
The code you provided is an HTML conditional comment. It can only work embedded in the HTML code. If you want to hide an element from an external stylesheet in the Outlooks on Windows (from 2007 and above), you can use the mso-hide:all property. It’s basically a display:none but for Word’s rendering engine. Although, contrary to display:none, this doesn’t always inherit to <table> children elements. In that case you could use a double selector like the following.
.your-element,
.your-element table {
mso-hide: all;
}
I have an active child theme called "Hello Elementor Child". Since other people have problems overriding Elementor and add !important to every css rule, I have done the same.
My problem is that nothing is overriding. When I "view source" and find a background image used on the home page, I can confirm that the link to that image is good. But, it's simply not showing up on the site.
I do not want to add all custom code to Elementor editor (or a css plugin) because (1) I don't have the pro version for this budget-conscious client and (2) I don't want a bunch of code in the head.
The style.css document
https://trimedia.co/hccpersonalcare/wp-content/themes/hello-theme-child-master/style.css?ver=1.0.0
Link to the background image so you know what it's supposed to look like: https://trimedia.co/hccpersonalcare/wp-content/themes/hello-theme-child-master/images/men-masked-personal-care-wide.jpg
Test location is https://trimedia.co/hccpersonalcare
If you shrink the viewport of your browser you will see a background image appear. The trouble is with your media queries, #media all and (max-width:600px) is missing a closing bracket. You have so many queries in there, I suggest chunking your code under a handful of common breakpoints so you can keep track of what overrides what better.
My External CSS and template was created by a friend fluent in CSS. But my friend isn't understanding that I don't know HOW to 'apply' (write) the tags in the HTML page to 'call' the CSS.
I know the difference between id (#whatever) and class (.whatever) But I don't know if a CSS entry like
.header caption (with styles listed) translates then to
'p class="header caption" with opening/closing tags ???
What I'm looking for, but not finding on the web, is a listing of how the most common tags are written as css. For example, I know
p class="left"
applies the CSS to align left, instead of HTML tag align="left" But How do I write the actual tag for
.table
.td
.tr
Is there a website to show:
"This is the tag in HTML, no External CSS" "This is the way to write the same tag for External CSS"
Second question... Other than for the 'p class' or easy tags, do I start every tag with:
class="" ?
p class="" ?
div class="" ?
When do I use SPAN vs DIV ?
I have searched for how to apply External CSS, for what tags to use--yes, I understand that every person might use different naming for divs and classes-- but I really need examples that will show the basic tags so I can plug in the 'different naming' from my
'external css'
Is there one website that shows (all on one page) examples of the tags? A website tutorial that doesn't assume novices already know how to write the tags to apply css?
Thanks
This is were I got my start in html. It teaches basic html and there are other videos that go along with it.
This will likely clear up some confusion with css.
Codeacademy.com is a much more thorough course of a multitude of web languages.
I was wondering if it was possible to manipulate the CSS of websites. For example color in the input fields? I had a look at several questions, but its not clear to me if it is possble at all.
For Example in Google Chrome, Whenever a field is selected it shows a golden line around the outsite. Is it possible to do this and other things in delphi, with any website. Writing CSS code that gets applied to the website opend in Twebbrowser? Just for personal viewing only
Thx
Can I change the color of an input field background with this code as well? I can change background colors and change font size, but cant seem to figure out to color in or border an input field. This is the code:
http://www.delphidabbler.com/tips/58
It is possible to modify CSS by adding a stylesheet from code, after the page is loaded:
var
document: IHTMLDocument2;
stylesheet: IHTMLStyleSheet;
stylesheetIndex: Integer;
begin
// Inject CSS Style Sheets
document := webBrowser1.Document as IHTMLDocument2;
stylesheetIndex := document.styleSheets.length;
if stylesheetIndex > 31 then
raise Exception.Create('Already have the maximum amount of CSS stylesheets');
stylesheet := document.createStyleSheet('', stylesheetIndex);
stylesheet.cssText := ...
Using #jasonpenny's answer to add a stylesheet, what you need next to change the border around the input element that has focus, is what in CSS is called the focus pseudo class or selector. For more information see these articles:
http://www.w3schools.com/css/css_pseudo_classes.asp
http://www.w3schools.com/css/sel_focus.asp
http://www.w3schools.com/css/css_border.asp
The http://www.w3schools.com site has a wealth of information on web development. It also allows you to play with many examples so you can see what the effects would be when you change things. If you are trying to learn how to do css styling you might be better of getting to grips with all the information there, instead of trying to learn programming and a programming language at the same time.
I have HTML page of few tables created by ASP.NET and when I do the "Page Setup" option before printing the paper size is already selected as "Letter" and I want that option to be in "A4". I changed the size of the table but its not working.
Is there any page setup information I can put in HTML so that "Page Setup" option can take it from there.
Please help.
Thanks
Anto
You have to use media type in CSS. This way you can specify a different set of styles for print and screen medias.
Here is an article about printer friendly pages. You can also read about media types in the W3C learning section.
You cannot change anything in the Print window from the HTML. You can just specify another CSS file for print media to make your page look better when you print it (like remove buttons, remove any content which is useless on a sheet of paper, change sizes, change fonts, etc.)
Hope this helps.
You could give it a try with CSS, using the #page rule. Mind that this is valid for CSS 2.0 and CSS 3.0 but not for CSS 2.1:
#page { size: A4 };
I'm not sure if this will change your default selected paper size though.