How to change the digits format on Plyr player - javascript

I am using Plyr for audio and video media, I want to use arabic/indian digits instead of english
I tried passing an i18n object but it doesn't have digits as keys

Related

How to start video at a specific time using media source buffer and fragmented mp4 without downloading entire segments?

I'm trying to use media source with source buffer on a fragmented mp4 file, I want to start the video at a specific time, say 10 second. I'm not able to find any example as such using sourcebuffer and media source.
I'm able to stream the video from 0th second to full, I need help in starting video playback from a desired timestamp
I tried with sourceBuffer.appendWindowStart, / sourceBuffer.timestampOffset that was not working as expected, or maybe my understanding of it is not correct.
I'm trying to follow this example, in this codesandbox
You can always change the video.currentTime on line 46 of the example you reference (before doing video.play()).
The system will start playing video once you have appended segments that refer to that timestamp.

Different currentTime for same video on different browsers

I want to get the currentTime for a video when video ends. But for different browsers, for the same video, currentTime returns different values after the third or forth digits after decimal. For ex. for particular video of length 30 seconds I am testing, currentTime value when video ends returns 30.069841 in Chrome and Firefox. But for the same video, it returns 30.0683333 in IE edge and Safari. Why is there a difference? And is there any way I can get the unique value in all the browsers?
Thank You in advance.
If your frame rate is something that cannot be expressed as a finite decimal number (or precisely expressed in a floating point number), which the value 30.0683333 looks like, it may be up to the browser to decide how to represent them. What is the frame rate of the video? Could it be 30fps by any chance? You could transcode it to e.g. 25fps and check then. If the video has an audio track then the audio time scale could come in play too. You could use ffmpeg to dump the actual timestamps of the video frames in the timescale expressed as a fractional number and then looking at the timestamp of the last frame you could try to understand what would be the decimal value. But you should provide more info on the timescale of the video and if it has an audio track.

Decode audio and play intro then looped part

I have a song, consisting of intro (I), a part to be looped (L), and ending (E). I don't want the ending to be played at all, i.e. audio file song = I + L + E, audio played = I + L + L + ...
I succeeded to do that by separating the intro and the loop into two files, but I want to do that "on-the-fly" on the client side.
How do I do that?
Web Audio API provides AudioBufferSourceNode.loopStart and AudioBufferSourceNode.loopEnd (source) precisely for that. You have to remember to set AudioBufferSourceNode.loop = true also.
If you want to play the file using Web Audio (e.g. decode into an AudioBuffer using decodeAudioData() and then play the sound with BufferSourceNodes), then it's easy to do by pointing two BufferSource Nodes at the buffer with different offsets, and looping the second one.
Web Audio uses doubles (not floats) - so the statement "this is much more accurate than float seconds" isn't generally true (doubles have around 15 decimal places of accuracy). (Depends on the absolute value, of course.) It's more than accurate enough to play with sample-accuracy (i.e. to not glitch between the values); if you're concerned, though, just cross-fade between them.
If your goal is really just to produce an audio file with that part looped, that's a little different; but it sounds like you want playback.

Detect 360 degree video on YouTube

Is there any method that find out whether a YouTube video type is spherical(360 degree) or not?
For 360 degree video, the YouTube video player shows an arrow key stick on left-upper side. Is it possible to notice that by looking at the HTML code?
I'm carefully looking at the html code of 360 video, but can't find any sign of it.
I've checked, and there is no difference in the link from the usual, both having the watch?v= format and both using an eleven digit code for the video's unique link. The only three ways of know is by watching the actual video and testing if it is 3D yourself, reading the comments or looking at the title (most 360 degree videos say that they are in the title).
To recognise what video your player is playing (360 or plain), there are two ways.
1. Direct querying to YouTube API.
You can simply query by this URL:
https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails,status&id=<YOUR_VIDEO_ID>&key=<YOUR_API_KEY>&alt=json
To obtain an API key, you must visit this page to check guide if you haven't it yet: https://developers.google.com/youtube/v3/getting-started. In the response, you should read the value contentDetails.projection as defined there: https://developers.google.com/youtube/v3/docs/videos#contentDetails.projection.
2. Indirect guess of video format.
First way is doing additional HTTP call which may beat performance, so we can use this way also. Iframe API Player has .getSphericalProperties(), which will be empty object if there is rectangular (plain) video presented, but will have something like {yaw: 0, pitch: 0, roll: 0, fov: 100.00004285756798}, if you're using 360 video.

How to get the range of characters

I am about to import SVG - Fonts with Javascript to be able to animate even single letters. Thereby i am storing the glyphs in an Javascript Object, where the Unicode-value of the glyph defines the key and the glyph itself becomes the value. So when i create text from a given string i use the each character from the string to get the suitable glyph for it.
And here comes my question:
The unicode-value of the glyphs unicode attribute (specified here) can be an XML character reference in hexadecimal (unicode="ffl") or decimal (unicode="ffl") notation. For the hkern- and vkern-elements (representing the kerning table) the characters given as Unicode Range (specified here and here). Is there any Library which could do the conversion from all these possible variations? Does anybody know a resource where i can find further information which could help me solving this problem?
The overall problem is to convert all possible variations of Input into a consistent list of unicode values i can use as Key for the glyph map.
Perhaps you could create a hidden element with automatic width (css width:auto), place your string into it, and then measure (perhaps with Mootools) the width of that element?

Categories

Resources