What is the exoplayer2 equivalent for Hls.Events.FRAG_LOADED event present in hlsJs library - http-live-streaming

We have used hlsJs library (ref: https://github.com/video-dev/hls.js) in Chrome browser to play HLS files.
There we have an event called Hls.Events.FRAG_LOADED which provides information about the hls fragment loaded like sequence number, start and end PTS and any custom tag attached to the fragment (ref: https://github.com/video-dev/hls.js/blob/master/docs/API.md#FRAG_LOADED)
Is there an equivalent event or api which we can listen to in ExoPlayerv2 for Android which can provide me same information about the media segment loaded?
Why I need this?
In my streaming server I am putting some custom EXT tag for each media fragment & i want to read that data when a media fragment is loaded in my player.
This is what I get from hlsJs on chrome browser for FRAG_LOADED event.
Need similar data from exoplayer
Any pointer will be helpful.
Thanks in advance.

You could try looking into the AdaptiveMediaSourceEventListener onLoadComplete method and use the DataSpec object to get both URL and Format objects which can be used to extract some data like bitrate and position of the segments. I do not know if there is an equivalent API out there for what you are looking for.

Related

How to change font and size of subtitles in libvlc sharp 3.4.0?

Seems i'm not getting the right way to code this.
I can do almost everything done to my media player be functional except for this.
This is a bit tricky, and not exposed by the LibVLC public API, which is why you can't find a C# function for this. But there is a way.
First, read how to use LibVLC options
Then find the one you want from the Wiki.
These look like what you're looking for
--freetype-rel-fontsize=<int> Size
--freetype-bold
--freetype-color=<int> color
Use it like this
var libvlc = new LibVLC("--freetype-bold", "--freetype-rel-fontsize=10", "--freetype-color=65280");
And you would get green, bold, extra large subtitles.
For looking up usage and parameter info, you can also check out how the VLC apps use it. Here is VLC for Android libvlc options usage.

How to make your own simple MPEG DASH player?

I was wondering if someone had already tried to make his own simple DASH player(and maybe has some examples/source codes) but without using dash.js repository on GITHUB , and if possible has any insights and tips on how to start with the creation/writing process?
Take a look at Building a simple MPEG-DASH streaming player:
Like described on this site following this steps should give you an idea:
Define an HTML5 video element in the HTML section of a page.
Create a MediaSource object in JavaScript.
Create a virtual URL using createObjectURL with the MediaSource object as the source.
Assign the virtual URL to the video element's src property.
Create a SourceBuffer using addSourceBuffer, with the mime type of the video you're adding.
Get the video initialization segment from the media file online and add it to the SourceBuffer with appendBuffer.
Get the segments of video data from the media file, append them to the SourceBuffer with appendBuffer.
Call the play method on the video element.
Repeat step 7 until done.
Clean up.

Using existing media element instead of createMediaElement

Is there an example of using an existing video element to attach the media streams rather than creating a new one with event.stream.createMediaElement()? I presume that's possible.
Thanks.
You cannot use an existing video or audio element (i.e. one that you created outside of vline) since the element returned from createMediaElement is tied to the stream inside the browser. What you can do is have a div where you want to display the video, and replace the media element inside the div.

How to print a pdf file from windows store application

I am creating a windows 8 app in c# and xaml.
How can i print a pdf file on my system from this app without launching the pdf reader of windows.
If a commercial library is an option, you could try Amyuni PDF Creator for WinRT.
From the documentation, the code for printing a PDF file in C# using this library would look like this:
// Printing on a XAML Windows Store Application
// The field AmyuniPDFCreator.PDFCreator m_pdfCreator; contains an instance of the PDFCreator control
TypedEventHandler<PrintManager, PrintTaskRequestedEventArgs> m_printTaskRequestedEventToken;
// Registering the Application View for printing
void RegisterForPrinting()
{
// Request a PrintManager instance
PrintManager printMan = PrintManager.GetForCurrentView();
// Add a handler for printing events.
m_printTaskRequestedEventToken = printMan.PrintTaskRequested += m_pdfCreator.Document.PrintTaskRequestedEventHandler;
}
// Unregistering the Application View for printing
void UnregisterForPrinting()
{
// Remove the handler for printing events.
PrintManager printMan = PrintManager.GetForCurrentView();
printMan.PrintTaskRequested -= m_printTaskRequestedEventToken;
}
More details about the library can be found here.
Disclaimer: I currently work as a developer of the library
It is possible to achieve this without any third party library if you want to print it with a device.
This isn't working to create or write a ".pdf"[Pdf File). To make this happen without another library you could maybe try to write images directly into a pdf, but i can only reference here the Pdf Documentation.
First of all you have to render your pdf. You can do this with Windows.Data.Pdf.
You can take a look at an example here. The libary will handle the Pdf and you get some BitmapImages rendered.
This library can read, but not write ".pdf"
Now you have to print your Images(rendered pdf pages). For this you take the Windows.Graphics.Printing.PrintManager.
I would not recommend the msdn example in this case.
So have a first look at Windows Store Apps and XAML Based Printing.
And you will find another printing example with MVVM here: Printing from MVVM XAML Windows 8 Store apps.
If you just follow the examples you will achieve to print a pdf on paper some trouble.
How to add custom settings for your printer is explained at How to add custom settings to the print preview UI (XAML)!
Windows 8 doesn't have an API to do this, so you'll have to acquire one elsewhere - something that's capable of properly rendering a PDF for you, and that's going to mean a full-blown PDF API with all the bells and whistles (I'm not aware of any of these for Windows 8 that only supports printing).
If only PDF Sharp had a WinRT version, I'd recommend it in a heartbeat... unfortunately it doesn't (yet). Only ones I know of that have an API for WinRT are Foxit and Siberix Report Writer.

Add support for new html tag

The major browsers have support for the <object/> tag.
I want to incorporate a video player on my site to play .mkv video, but I cannot use most because the are based on flash, which can only play .flv & .f4v.
That's why I'm switching to the <object/> tag
But, if I wanted to incorporate a tag with the name of <mkvvideo/>, would a simple plugin associated with that tag be usable, or does the core programming of the browser handle that?
Thanks
You can't associate plugins with tags.
Instead you register the mimetypes (and file extensions) that your plugin supports and use that mimetype with the object tag (in this case video/x-matroska).

Resources