Write Picture to mp3 File ID3.NET Windows Store Apps - c#

I'm working in my new app to modify the ID3 Tags.
I can edit title,album and artists but I can't modify the Pictures.
Here is my small code
IList<string> artists = new List<string> { "test artist" };
tag.Title.Value = "my test";
tag.Album.Value = "album test";
tag.Artists.Value.Add("test artist");
tag.Pictures.Add(new Id3.Frames.PictureFrame
{
PictureData = array,
PictureType = Id3.Frames.PictureType.Media,
MimeType = "image/jpeg"
});
stream.WriteTag(tag, 1, 0, WriteConflictAction.Replace);
stream.Dispose();
When I open the mp3 file I can't see the image while it's playing.
Could you help me? Thank you.

stream.WriteTag(tag, 1, 0, WriteConflictAction.Replace);
1 represents the major and 0 the minor ID3 version. Since media types such as pictures/images are not implemented in version 1, you'll need to use at least version 2. (2.3 being the most popular version used in ID3 tagging libraries and 2.4 being the newest version released in 2000)
stream.WriteTag(tag, 2, 3, WriteConflictAction.Replace);
will resolve your issue. Please note that you also need to create an Idv23Tag when applying the code above:
var tag = new Id3v23Tag();
See http://en.wikipedia.org/wiki/ID3 for more information.

Related

How to fetch google analytics data api GA4 in .net core?

var request = new RunReportRequest
{
Property = $"properties/{_settings.GoogleAnalytics.PropertyId}",
Dimensions = {new Dimension {Name = "eventName"}, new Dimension {Name = "customEvent:event_category" } },
DimensionFilter = click,
Metrics = {new Metric {Name = "eventCount"}},
DateRanges =
{
new DateRange
{StartDate = startDate.ToString("yyyy-MM-dd"), EndDate = endDate.ToString("yyyy-MM-dd")}
}
};
var response = await _analyticsClient.GetClient().RunReportAsync(request);
I'm using .NET core and the nuget package Google.Analytics.Data.V1Beta to query Google Analytics.I have doubt on how to get response.I have searched a lot but cant able to find solution.
I've encountered the exact same problem. Please make sure to install the latest pre-release build. (as natively the latest build doesn't come with the required methods and return types as stated in all of the tutorials online regarding .NET.. go figure..)
Steps:
Nuget Package Manager
Go to installed packages (tick the show
pre-release checkbox)
Select your package.
Update Accordingly

MIP SDK - What are the available UserRights in MIP SDK?

I am trying to apply "PRINT" UserRight to ProtectionDescriptor but its not opening PDF file content.
Trying to find list of UserRights for MIP SDK. I tried "OWNER", it works. But I do not want to give "OWNER" rights. Any help would be great.
var newRights = new List<UserRights>();
foreach (UserSet userset in options.userSet)
{
newRights.Add(new UserRights(new List<string> { userset.Users }, new List<string> { "PRINT" }));
};
ProtectionDescriptor protectionDescriptor = new ProtectionDescriptor(newRights);
You must also include VIEW. VIEW is the base required right to open the content.
Full rights are here: https://learn.microsoft.com/en-us/azure/information-protection/configure-usage-rights

Recreating thumbnail from existing asset in Azure Media Services

I am using Azure Media Services and Azure Functions to build a VOD element for a website. Basically, when the source video is uploaded a blob trigger starts off a DurableOrchestration to create an asset and then encode the video. It also generates 3 different size thumbnails using the default {Best} frame. So far so good.
What I want to do now is allow the user to select a frame from the encoded video and choose that to be the poster thumbnail.
I have an HttpTrigger which takes the asset id and the frame timestamp and kicks off another durable function which should recreate the thumbnails at the specified frame.
But it isn't working.
I originally got 3 blank images in a new asset and when I tried to force it to put the images back into the original asset, I got nothing.
This is the code I'm using to try to achieve this. It's pretty much the same as the code to create the original asset. The only real difference is that the json preset only has instruction for generating thumbnails, the asset already has 6 encoded videos, 3 thumbnails and associated meta files in it, and I'm not passing the original source video file to it (because I delete that as part of the clean-up once the original encoding is complete).
PostData data = inputs.GetInput<PostData>();
IJob job = null;
ITask taskEncoding = null;
IAsset outputEncoding = null;
int OutputMES = -1;
int taskindex = 0;
bool useEncoderOutputForAnalytics = false;
MediaServicesCredentials amsCredentials = new MediaServicesCredentials();
try
{
AzureAdTokenCredentials tokenCredentials = new AzureAdTokenCredentials(amsCredentials.AmsAadTenantDomain,
new AzureAdClientSymmetricKey(amsCredentials.AmsClientId, amsCredentials.AmsClientSecret),
AzureEnvironments.AzureCloudEnvironment);
AzureAdTokenProvider tokenProvider = new AzureAdTokenProvider(tokenCredentials);
_context = new CloudMediaContext(amsCredentials.AmsRestApiEndpoint, tokenProvider);
IAsset asset = _context.Assets.Where(a => a.Id == data.assetId).FirstOrDefault();
// Declare a new encoding job with the Standard encoder
int priority = 10;
job = _context.Jobs.Create("CMS encoding job", priority);
foreach (var af in asset.AssetFiles)
{
if (af.Name.Contains(".mp4)"))
af.IsPrimary = true;
else
af.IsPrimary = false;
}
// Get a media processor reference, and pass to it the name of the
// processor to use for the specific task.
IMediaProcessor processorMES = MediaServicesHelper.GetLatestMediaProcessorByName(_context, "Media Encoder Standard");
string preset = null;
preset = "MesThumbnails.json"; // the default preset
string start = data.frame;
if (preset.ToUpper().EndsWith(".JSON"))
{
// Build the folder path to the preset
string presetPath = Path.Combine(System.IO.Directory.GetParent(data.execContext.FunctionDirectory).FullName, "presets", preset);
log.Info("presetPath= " + presetPath);
preset = File.ReadAllText(presetPath).Replace("{Best}", start);
}
taskEncoding = job.Tasks.AddNew("rebuild thumbnails task",
processorMES,
preset,
TaskOptions.None);
// Specify the input asset to be encoded.
taskEncoding.InputAssets.Add(asset);
OutputMES = taskindex++;
string _storageAccountName = amsCredentials.StorageAccountName;
outputEncoding = taskEncoding.OutputAssets.AddNew(asset.Name + " MES encoded", _storageAccountName, AssetCreationOptions.None);
asset = useEncoderOutputForAnalytics ? outputEncoding : asset;
job.Submit();
await job.GetExecutionProgressTask(CancellationToken.None);
My question is whether what I am trying to do is actually possible, and if so what is wrong with the approach I'm taking.
I've searched quite a bit on this topic but can always only find reference to generating thumbnails whilst encoding a video, never generating thumbnails from encoded videos after the event.
I'm not passing the original source video file to it
That's likely why you are running into the problem. The output of your Adaptive Streaming Job, as you have seen, contains multiple files. There are some additional flags needed to tell the thumbnail generation Job to focus on just one file (typically the highest bitrate file). The preset below should do the trick.
Note how the preset starts with a Streams section which tells the encoder to pick the highest/top bitrate for video and audio
Note that the Step is set to 2, but range is 1, ensuring only one image is generated in the output
{
"Version": 1.0,
"Sources": [
{
"Streams": [
{
"Type": "AudioStream",
"Value": "TopBitrate"
},
{
"Type": "VideoStream",
"Value": "TopBitrate"
}
]
}
],
"Codecs": [
{
"Start": "00:00:03:00",
"Step": "2",
"Range": "1",
"Type": "JpgImage",
"JpgLayers": [
{
"Quality": 90,
"Type": "JpgLayer",
"Width": "100%",
"Height": "100%"
}
]
}
],
"Outputs": [
{
"FileName": "{Basename}_{Index}{Extension}",
"Format": {
"Type": "JpgFormat"
}
}
]
}

How to get the latest videos from YouTube watch history

I want to get the latest videos from YouTube watch history. I am using the following code, but the video size is always different and very rarely is equal to 100. How can I resolve this problem?
YouTubeRequestSettings ytSettings = new YouTubeRequestSettings(AppKey, DevKey, currentLogin, currentPassword);
ytSettings.PageSize = 10;
ytSettings.AutoPaging = true;
YouTubeRequest ytRequest = new YouTubeRequest(ytSettings);
string uri = "https://gdata.youtube.com/feeds/api/users/default/watch_history?v=2";
Feed<Video> videos = ytRequest.Get<Video>(new Uri(uri));
List<string> vids = new List<string>();
foreach (Video vid in videos.Entries)
{
if (vids.Count < 100)
{
vids.Add(vid.VideoId.ToString());
}
else
{
break;
}
}
I'm pasting the link so that someone might find it useful for their knowledge
http://www.codeproject.com/Articles/143669/Manage-YouTube-using-C-and-Youtube-API
Update:
Hi I got the links from google developers . There are four methods defined there for .NET . so we've to dig ourselves about recent uploads . As I can't see any recent videos headings for .NET
https://developers.google.com/youtube/v3/code_samples/dotnet
https://github.com/youtube/api-samples/tree/master/dotnet

Telerik upload manager - Folder creates and deletes but refresh images stays

Having problems with the documentmanager upload trying to upload PDF's.
The problem happens when creating or deleting folders. The get create/deleted in the correct location but the refresh/processing image stays, crashing the tool from navigating the folder structure. See screen shot:
There is a Javascript error :
this._clientParameters.get_value is not a function
CODE
FileManagerDialogParameters documentManagerParameters = new FileManagerDialogParameters();
documentManagerParameters.ViewPaths = new string[] { uploadPath };
documentManagerParameters.UploadPaths = new string[] { uploadPath };
documentManagerParameters.DeletePaths = new string[] { uploadPath };
documentManagerParameters.SearchPatterns = pattern;
documentManagerParameters.MaxUploadFileSize = maxFileSize;
if (string.IsNullOrEmpty(dialog))
{
// use a default
dialog = "~/modules/uploadcentre/dialogs/default/";
}
documentManagerParameters["ExternalDialogsPath"] = dialog;
DialogDefinition documentManager = new DialogDefinition(typeof(DocumentManagerDialog), documentManagerParameters)
{
ClientCallbackFunction = "DocumentManagerFunction",
Width = Unit.Pixel(694),
Height = Unit.Pixel(440)
};
DialogOpener1.DialogDefinitions.Add("DocumentManager", documentManager);
Telerik.web.ui version 2011.1.519.40
Thanks in advance
Peter
Please, see the following forum thread which discusses the same JS error:
DocumentManager open with DialogOpener javascript error - http://www.telerik.com/community/forums/aspnet-ajax/editor/documentmanager-open-with-dialogopener-javascript-error.aspx
If you need further help, please open a support ticket from www.telerik.com and send a sample fully working project that demonstrates the problem.
Best regards,
Rumen
http://www.telerik.com/community/forums/aspnet-ajax/editor/document-manage-refreshing-image-stays-on.aspx

Categories