A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

AI OnAI Off

VideoFile (Video) Player

Vote:
 

Hello all,

I have a VideoFile.cs model as well as it's View (Views/VideoFile/Index.cshtml), with a disabled download control on a player.

However when I upload video through TinyMCE -> Insert/edit media, it then uses some other than my player and has download control enabled.

How can I make it use my player which is in Views/VideoFile/Index.cshtml?

Also when TinyMCE -> Insert/edit media -> Advanced used, nothing is being inserted, why so?

Thank you, cheers!

#223399
May 27, 2020 11:06
Vote:
 

Hi Ričardas,

Can you please share your VideoFile.cs and view file code here?

#223400
May 27, 2020 12:01
fuji - May 28, 2020 8:06
Hi Ravindra,

just pinging you since added requested files in separate post, thanks for your reply!
Ravindra S. Rathore - May 28, 2020 8:40
I didn't found an error in your code files its something defiantly related with TinyMCE
fuji - May 28, 2020 8:50
Oh, ok, I guess it is, thanks anyway!
Vote:
 

VideoFile.cs

using EPiServer.Core;
using EPiServer.DataAnnotations;
using EPiServer.Framework.DataAnnotations;

namespace Website.Web.Models.Media
{
    [ContentType(GUID = "85468104-E06F-47E5-A317-FC9B83D3CBA6")]
    [MediaDescriptor(ExtensionString = "flv,mp4,webm")]
    public class VideoFile : VideoData
    {
    }
}

View:

@model VideoFile

@{ 
    string videoUrl = Url.ContentUrl(Model.ContentLink);
    string videoExtension = Path.GetExtension(videoUrl ).Replace(".", "");
}

<video controls controlsList="nodownload">
    <source src="@videoUrl " type="video/@videoExtension">
    Your browser does not support the video tag.
</video>

But I now guess I should cover this question more on TinyMCE side than VideoFile model, something as here https://www.tiny.cloud/docs/plugins/media/#audio_template_callback

#223412
May 27, 2020 15:13
Vote:
 

Hi,

What you could do is add a UI descriptor for your video file:

[UIDescriptorRegistration]
public class VideoFileDescriptor : UIDescriptor<VideoFile>, IEditorDropBehavior
{
	public EditorDropBehavior EditorDropBehaviour
	{
		get;
		set;
	}

	public VideoFileDescriptor()
	{
		EditorDropBehaviour = EditorDropBehavior.CreateContentBlock;
	}
}

This means that when an editor drag-and-drops in from the assets pane it won't create a link (the default) but will instead insert it as content—which will use your view.

I think that'd be the easiest way to solve this and get the behaviour you want here.

#223746
Edited, Jun 03, 2020 14:46
error This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.