I have written a simple parser for parsing Media Playlist file (m3u8) (HLS stream)
"EXT-X-PLAYLIST-TYPE" tag is used to determine the type of content i.e. whether the content is VOD (can't change) or EVENT (can change).
My problem is that "EXT-X-PLAYLIST-TYPE" is an optional tag. If EXT-X-PLAYLIST-TYPE tag is not present in the Media Playlist file, is there a way I can determine the content type?
Currently I check for "EXT-X-ENDLIST" which indicates that no more Media Segments will be added to the Media Playlist file. Is this approach check correct?
Okay, I think it should be fine, According to the player playlist specification:
https://datatracker.ietf.org/doc/html/draft-pantos-http-live-streaming-14#page-29
If the Media Playlist contains the final Media Segment of the
presentation then the Playlist file MUST contain the EXT-X-ENDLIST
tag; this allows clients to minimize unproductive Playlist reloads.
If a Media Playlist does not contain the EXT-X-ENDLIST tag, the
server MUST make a new version of the Playlist file available that
contains at least one new Media Segment. It MUST be made available
relative to the time that the previous version of the Playlist file
was made available: no earlier than one-half the target duration
after that time, and no later than 1.5 times the target duration
after that time. This allows clients to utilize the network
efficiently.
In RFC8216, Live playlist MUST NOT contain EXT-X-PLAYLIST-TYPE tag because :
all the valid values of the tag (VOD,EVENT) indicate that playlist must NOT be changed during playback
Live stream (not VOD) allows server implementations to limit number of available media segment at any time point (e.g. by removing segments already served at the beginning)
That is one of the reasons why EXT-X-PLAYLIST-TYPE tag is optional.
Related
Here is the example image url I found on Steam.
https://steamcommunity-a.akamaihd.net/public/shared/images/header/globalheader_logo.png?t=962016
The image url gives the same result with or without the ?t=962016. What is it called? And what does it do?
?t=962016
This is a technique to disable browser caching, browser sees it as a new url, and fetches the resource again from web server. The resource can be image, css file, js file etc. This is the most common use case, but can be also used differently by the web server.
There is another use case also. I have done this one of my project.
I have a made all requests to *.jpg handle by a php script.
Eg: mysite.com/user/avatar.jpg?id=100
avatar.jpg is actually a php script which takes the query param (in this case the id 100) and returns the correspond user's avatar (user with id 100). Browser see this as an image. Another advantage is we can disable hot linking directly to this image, as the script can check if the request is originated from the same domain.
IMO there is 2 possibilities
- They put that parameter to avoid the image to be cached, the value of t is random in this case
- The image can be generated by a script, in this case the value of t is the id of the image.
I have a Plone 4 site where I currently use the following method to embed objects (e.g. images, videos, tables …) in user-editable HTML content:
I have a custom transform browser which takes HTML text and transforms all a and img elements which refer to an element by UID (i.e., which have an href="…/resolveuid/abc123…" or src="…/resolveuid/abc123…").
My view templates read the text field and let that browser transform it;
the browser has a Python dict TYPE2TEMPLATE which has portal_type keys and template_id values;
for each a or img which refers to an object by UID,
the object is fetched by o = brain._unrestrictedGetObject()
the template id t_id is taken from the TYPE2TEMPLATE dict
the "embed" method is fetched by method = o.unrestrictedTraverse(t_id)
that method is called (in some cases with some keyword arguments), and the result - which is contained in one top HTML element - replaces the "raw" a or img element.
Now that I'm developing an additional customization package (which contains new object types, now using Dexterity), I wonder whether there is some more "plonish" way. Is there, for example, some embed action?
i don't know of a package that does the same and what you're doing sounds sane to me ;-)
i just would use https://pypi.python.org/pypi/plone.outputfilters instead of your transform BrowserView.
if it's possible to explicitly mark links that should not be auto-embedded (eg via span.noEmbed a.internal-link selector) this could become a useful addon.
i guess for portal_type=='File' you'll need to check the mimetype too in order to decide if you're embedding a video file or something else...
other products i know of embed content outside of your plone site (eg. collective.embedly)
another approach would be a to use a tinymce plugin to genereate the proper embed html when editing the html-body of your page (i personally would not go this route because there are different tiny versions to support for 4.3 and 5.0 and we're not sure if tiny woun't be replaced as default editor in the future)
Is there a possibility to check if all of the background images exist in a CSS file?
Without using every selector on the page so that this appears in Firebug NET tab.
There is no in CSS way to do this, since the standard says that "an image that is empty (zero width or zero height), that fails to download, or that cannot be displayed (e.g., because it is not in a supported image format) [...] draws nothing" (cite).
You have to parse your CSS file and check all paths. You could do this with JavaScript in your browser, however I believe it's easier to write a Python script or even a small binary application that parses your CSS files and checks whether the files actually exists.
I use an ASP.NET web handler to combine my CSS files.
The URL format that this requires is:
/Combiner.ashx?f=~/stylesheets/reset.css--~/stylesheets/base.css&t=text/css&v=3.1.4.2113
It takes any number of CSS files to combine followed by the type and finally the version number of the site assembly.
The HTTP expires header is set to one month in the future.
Since I'm including the version number in the query string I would have hoped that this would stop browsers serving up invalid content. However, the version number appears to be getting ignored and both Chrome and IE both think the content is not modified.
I have confirmed that the version number has definitely changed.
Any ideas as to why this is being ignored?
I'm trying to make a web based media player using the HTML5 audio element implemented in Firefox 3.5 and Chrome. Reading Mozillas documentation, omitting the autobuffer attribute should result in the audio src not being requested:
if specified, the audio will
automatically begin being downloaded,
even if not set to automatically play.
This continues until the media cache
is full, or the entire audio file has
been downloaded, whichever comes first
However, on the server side I notice the files are being requested anyway. My sample page is very simple:
<html>
<body>
<audio src="1.ogg"></audio>
<audio src="2.ogg"></audio>
</body>
</html>
The autobuffer attribute has been replaced with preload which accepts the values none, metadata and auto.
A patch has been submitted for WebKit (issue #35385; unfortunately I can't link to it), but it seems that it hasn't made it into Safari 4.0.5.
Boolean attributes in HTML5 can't be false. If it's present at all, it's true.
You've been led astray by XHTML habits.
See:
http://dev.w3.org/html5/spec/Overview.html#boolean-attributes
Quote:
"The values "true" and "false" are not allowed on boolean attributes. To represent a false value, the attribute has to be omitted altogether."
According to the article "Configuring Servers for Ogg Media", Ogg media does not contain duration information, so to correctly display a slider you need to include an X-Content-Duration header. If you don't include such a header, Firefox will prefetch portions of the media* so that it can work out the duration and display a slider.
That could be your problem.
* It will fetch the first few bites, which should give it a Content-Length header so it knows the file size. It will then use that file size to fetch the last few bites, from which it can work out the duration. If your server does not support Range requests, the result will be that it'll fetch the whole file.