Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

can we try to make it with MediaPlayerElement as well? #50

Open
touseefbsb opened this issue Jan 12, 2018 · 17 comments
Open

can we try to make it with MediaPlayerElement as well? #50

touseefbsb opened this issue Jan 12, 2018 · 17 comments

Comments

@touseefbsb
Copy link

I knw this question has been asked previously and I already know the answer, that you are actually creating all the features of media element yourself and not using the actual media element I have a few questions regarding that.

  1. Why arent you using the actualy uwp media element?
  2. Can we implement all the features of MediaPlayerElement? just like you implemented features of media element?
  3. Or can we create a custom inherited control from MediaPlayerElement and then somehow use vlc library in it?

The reason I am asking these questions is that is there any possible way that we can use MediaPlayerElement and hence using all its features like MediaPlaybackItem, MediaPlaybackList and all other built in features in uwp. I will be willing to help and achieve this goal if you guide me a little bit how to include vlc library in uwp MediaPlayerElement.

Thanks in advance.

@kakone
Copy link
Owner

kakone commented Jan 13, 2018

  1. Why arent you using the actualy uwp media element?

Because you can't override the rendering part, you can't set a custom inner mediaplayer.

  1. Can we implement all the features of MediaPlayerElement? just like you implemented features of media element?

You can't implement all the features because you will be restricted by the features available in libVLCX, but you should be able to rewrite a lot of things.

  1. Or can we create a custom inherited control from MediaPlayerElement and then somehow use vlc library in it?

No, you can't inherit from the MediaPlayerElement because you can't set a custom MediaPlayer. You must do a custom control and reimplement all the things you want (without the source code of MediaPlayerElement and MediaPlaybackList to help).

@touseefbsb
Copy link
Author

so does that mean we cant even see the code of media element or mediaplayerelement? and you just made a new custom control and rewrite all the features you can think of? Because if we have the actualy c# code of media element and mediaplayerelement, then we can actually rewrite only those parts which use the media player engine and swap that with libvlc engine and other stuff can be mostly be copied over. But we cant see the code right? because I tried to peek the definition and they show us the methods definitions but they are all locked and we cnt see code in them.
@kakone

@touseefbsb
Copy link
Author

@kakone btw in vs 2017, 15.6 preview 2 they have introduced a new feature in which you can peek definition of compiled libraries and see the actual code with help of a decompiler, not sure whether this feature will also let us see the code for xaml controls.
here is the link where they discribe this feature. what do you think will it help us in our particular scenario?
https://www.visualstudio.com/en-us/news/releasenotes/vs2017-preview-relnotes#productivity

@kakone
Copy link
Owner

kakone commented Jan 13, 2018

It will not help because UWP assemblies are compiled to native code, there is no IL code. I don't think that we will see the source code soon. The only thing we have is the XAML style of the MediaTransportControls (in C:\Program Files (x86)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\10.0.16299.0\Generic\generic.xaml file). We have to rewrite the rest.

@touseefbsb
Copy link
Author

@kakone Thanks for the clarification :)

@touseefbsb
Copy link
Author

@kakone another question regarding the generic.xaml, if I use this file to take out styles, as it is generic.xaml file of Fall creators update, so will that style work fine on previous version as well? considering my app minimum target is creators update?

@touseefbsb touseefbsb reopened this Jan 13, 2018
@kakone
Copy link
Owner

kakone commented Jan 13, 2018

Yes, it will work on previous versions.

@kakone
Copy link
Owner

kakone commented Jan 13, 2018

According to you, what really useful features available in the MediaPlayerElement control are missing in the VLC.MediaElement control ?
I think we can easily rewrite a VLC.MediaPlayerElement in the library. The two controls will use the same MediaTransportControls.

@touseefbsb
Copy link
Author

@kakone
well if you are willing to do that then I can give you a complete and detailed list of features tht why mediaplayerelement is a lot better than media element, but for now some of the main features are following.

MediaPlaybackItem :

MediaSource is usually used in mediaelement but mediaplaybackitem is an extension of mediaSource which includes audio tracks, video tracks, and TimedMetaDataTracks ( contains embeeded subtitles in the video file ).

MediaPlaybakcList:

This list is optimized and specially designed to give features of playlists in the app, and it used a list of MediaPlaybackItems and then there are some methods to shuffle, and do other stuff which typically a playlist does.

SMTC:

Mediaplayerelement is automatically synced with system media transport controls. we only have to set the thumbnail and file name with them but the pause/play and next/previous buttons of smtc automatically work without any effort.

MediaPlayer

SetMediaPlayer() is a method on mediaplayerelement, with this we can set a mediaplayer object to it and control all media functionalities with mediaplayerelement.mediaplayer object, a big advantage of this feature is that we can do a lot of custom logic with respect to the app, including a use case in which we can have a global static media player object and assign it to any mediaplayerelement on any page in the app and that media player will retain the file playing and its position and other stuff too, I havent tried to implement this feature yet, but will probably do once I figure out these basic problems.

There are many style changes and improved UI in mediaplayerelement as well which will only be known once we explore its style properly.

@touseefbsb
Copy link
Author

@kakone I asked the question about generic xaml styles bcz, there is some stuff in newer SDKs like reveal style on transportcontrol buttons and acrylic background etc. so if I use the latest style, that wont cause a problem in older versions? I mean those styles are automatically responsive to version numbers and we dont have to care about that?

@kakone
Copy link
Owner

kakone commented Jan 13, 2018

Yes, if there are some styles that doesn't exist in previous versions, there will be a problem. You can't use runtime API checks to determine the presence of XAML resources. So, you must only use resource keys that are available in the minimum version that your app supports or a XAMLParseException will cause your app to crash at runtime.

I'm currently adding the latest version of the MediaTransportControls style with a new RepeatButton.

@touseefbsb
Copy link
Author

@kakone Yeah that is wht I was thinking too. Also what do you think about the mediaplayerelement features I told u ?

@kakone
Copy link
Owner

kakone commented Jan 13, 2018

I'm looking the MediaPlayerElement control. I think I will propose a custom VLC.MediaPlayerElement, the features you proposed should be not so difficult to implement.

@touseefbsb
Copy link
Author

@kakone Thats great, and if you need any kind of suggestions or help in that project or detailed docs of any component related to these features I'll be happy to help you in all that .
for now following are some useful docs regarding some important objects.

Playing with MediaPlayBackItem : https://docs.microsoft.com/en-us/windows/uwp/audio-video-camera/media-playback-with-mediasource

MediaSource: https://docs.microsoft.com/en-us/uwp/api/windows.media.core.mediasource

MediaPlayBackItem: https://docs.microsoft.com/en-us/uwp/api/Windows.Media.Playback.MediaPlaybackItem

MediaPlayerElement: https://docs.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Controls.MediaPlayerElement

MediaPlayerPresenter: https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.mediaplayerpresenter

MediaPlayer: https://docs.microsoft.com/en-us/uwp/api/windows.media.playback.mediaplayer

MediaPlaybackList: https://docs.microsoft.com/en-us/uwp/api/Windows.Media.Playback.MediaPlaybackList

P.S : I will suggest you to make the minim project target of VLC.MediaPlayerElement as "Creators Update" Because conditional xaml was introduced in this SDK update and with that xaml becomes very easy and responsive to sdks and we dont have to go through trouble of setting xaml from code behind by checking the API contracts dynamically, it will be beneficial in implementing some features and will be benficial in maintaining the project in the long run, and eventually all devices will update the windows 10 version anyways so very soon anniversay update will be supported by only a few devices.

@touseefbsb
Copy link
Author

@kakone any progress on this? :)

@kakone
Copy link
Owner

kakone commented Jan 25, 2018

No, unfortunately, I didn't have time to do it until now.

@touseefbsb
Copy link
Author

@kakone Ok please let me know on this issue when you have time so we can discuss this ( if needs be ) and move this forward thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants