Coder Social home page Coder Social logo

vimeo-dot-net's Introduction

vimeo-dot-net

A .NET 4.5/.NET Standard 1.3 wrapper for Vimeo API v3.0. Provides asynchronous API operations.

NuGet URL

Build status

COMPLETED

  • Account Authentication (OAuth2)
  • Account information retrieval
  • Account video and video list retrieval
  • User information retrieval
  • User video and video list retrieval
  • Chunked video upload with retry capability
  • Video metadata update
  • Fixed to fetch thumbnail property
  • Allow to fetch all videos from folder
  • Allow to delete thumbnail

API COVERAGE

/me/information Complete? API Method
Get user information ✔️ GetAccountInformationAsync()
Edit user information ✔️ UpdateAccountInformationAsync()
Get a list of a user's Albums. ✔️ GetAccountAlbumsAsync()
Create an Album. ✔️ CreateAlbumAsync()
Get info on an Album. ✔️ GetAlbumAsync()
Edit an Album. ✔️ UpdateAlbumAsync()
Delete an Album. ✔️ DeleteAlbumAsync
Get the list of videos in an Album. ✔️ GetAlbumVideosAsync()
Check if an Album contains a video. ✔️ GetAlbumVideoAsync()
Add a video to an Album. ✔️ AddToAlbumAsync()
Remove a video from an Album. ✔️ RemoveFromAlbumAsync()
Get a list of videos uploaded by a user. ✔️ GetVideosAsync()
Begin the video upload process. ✔️ GetUploadTicketAsync()
Check if a user owns a clip. ✔️ GetUserVideo()
Get a all videos uploaded into the folder by user. ✔️ GetAllVideosFromFolderAsync()
Delete a thumbnail. ✔️ DeleteThumbnailVideoAsync()

REFERENCE

API 3 Guide
API 3 Endpoints

HOW TO AUTHENTICATE

Video uploads and other secure operations to a user account require you to authenticate as your app and also authenticate the user you are managing. This will require setting up an app in your Vimeo account via developer.vimeo.com, requesting upload permission, and waiting for permission approval. Once you have your app set up and approved for uploads, you are ready to perform authentication. Here is a simplified example of authenticating your app and then authenticating your user, giving you access to all of the features this library offers:

var clientId = "your_client_id_here";
var clientSecret = "your_client_secret_here";
// This URL needs to be added to your 
// callback url list on your app settings page in developer.vimeo.com.
var redirectionUrl = "https://your_website_here.com/wherever-you-send-users-after-grant";
// You can put state information here that gets sent
// to your callback url in the ?state= parameter
var stateInformation = "1337";
var client = new VimeoDotNet.VimeoClient(clientId, clientSecret);
var url = client.GetOauthUrl(redirectionUrl, new List<string>() 
  {
    "public",
    "private", 
    "purchased", 
    "create", 
    "edit", 
    "delete", 
    "interact", 
    "upload", 
    "promo_codes",
    "video_files"
    }, stateInformation);
// The user will use this URL to log in and allow access to your app.
// The web page will redirect to your redirection URL with the access code in the query parameters.
// If you are also the user, 
// you can just pull the code out of the URL yourself and use it right here.
Console.WriteLine(url);
Console.WriteLine("Give me your access code...");
var accessCode = Console.ReadLine();
var token = await client.GetAccessTokenAsync(accessCode, redirectionUrl);
//we need a new client now, if it is a one off job you can just
//you are now ready to upload or whatever using the userAuthenticatedClient
var userAuthenticatedClient = new VimeoDotNet.VimeoClient(token.AccessToken);
            

vimeo-dot-net's People

Contributors

andrewkoransky avatar atakanozgun avatar badams229 avatar bassill avatar basvg avatar brsmith080 avatar cboyce428 avatar cspwizard avatar dependabot[bot] avatar fbichara avatar foamzy avatar jaredbaszler avatar justinspradlin avatar karan12990 avatar lostscout avatar m-gug avatar matthewhartz avatar mavericken avatar mfilippov avatar misinformeddna avatar mkmurali avatar mohibsheth avatar mrctms avatar needham-develop avatar omansak avatar robinminto avatar robmalvern avatar robson-rocha avatar scommisso avatar spencercrissman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vimeo-dot-net's Issues

Upload thumbnails

Here is the code change required for uploading thumbnail to a video. make sure your image is same size as your original video size.

Picture.cs
`///


/// link
///

public string link { get; set; }

///


/// resource_key
///

public string resource_key { get; set; }`


VimeoClient_Sync.cs
`///


/// Set thumbnail
///

/// clipId
/// image path
///
public void UploadThumbnail(long clipId, string path)
{
try
{
Picture pic = GetPictureAsync(clipId).RunSynchronouslyWithCurrentCulture();

            using (var file = new BinaryContent(path))
            {
                UploadPictureAsync(file, pic.link).RunSynchronouslyWithCurrentCulture();
            }
            SetThumbnailAsync(pic.uri).RunSynchronouslyWithCurrentCulture();
        }
        catch (AggregateException ex)
        {
            ExceptionDispatchInfo.Capture(ex.InnerException).Throw();
            return;
        }
    }`

VimeoClient_Videos.cs
` ///


/// Get picture
///

/// ClipId
/// Picture
public async Task GetPictureAsync(long clipId)
{
try
{
ThrowIfUnauthorized();

            IApiRequest request = ApiRequestFactory.GetApiRequest(AccessToken);
            request.Method = Method.POST;
            request.Path = Endpoints.Pictures;
            request.UrlSegments.Add("clipId", clipId.ToString());

            IRestResponse<Picture> response = await request.ExecuteRequestAsync<Picture>();
            UpdateRateLimit(response);
            CheckStatusCodeError(response, "Error retrieving account video.", HttpStatusCode.NotFound);

            if (response.StatusCode == HttpStatusCode.NotFound)
            {
                return null;
            }
            return response.Data;
        }
        catch (Exception ex)
        {
            if (ex is VimeoApiException)
            {
                throw;
            }
            throw new VimeoApiException("Error retrieving account video.", ex);
        }
    }

    /// <summary>
    /// upload picture asynchronously
    /// </summary>        
    /// <param name="fileContent">fileContent</param>
    /// <param name="link">link</param>
    /// <returns>upload pic </returns>
    public async Task UploadPictureAsync(IBinaryContent fileContent, string link)
    {
        try
        {
            if (!fileContent.Data.CanRead)
            {
                throw new ArgumentException("fileContent should be readable");
            }
            if (fileContent.Data.CanSeek && fileContent.Data.Position > 0)
            {
                fileContent.Data.Position = 0;
            }
            ThrowIfUnauthorized();
            IApiRequest request = ApiRequestFactory.GetApiRequest(AccessToken);
            request.Method = Method.PUT;
            request.Path = link;
            request.Headers.Add(Request.HeaderContentType, "image/jpeg");

            request.Headers.Add(Request.HeaderContentLength, fileContent.Data.Length.ToString());
            request.BinaryContent = fileContent.ReadAll();

            IRestResponse response = await request.ExecuteRequestAsync();

            CheckStatusCodeError(null, response, "Error generating upload ticket to replace video.");

            //return response.Data;
        }
        catch (Exception ex)
        {
            if (ex is VimeoApiException)
            {
                throw;
            }
            throw new VimeoUploadException("Error Uploading picture.", null, ex);
        }
    }


    /// <summary>
    /// set thumbnail picture asynchronously
    /// </summary>                
    /// <param name="link">link</param>
    /// <returns>Set thumbnail pic </returns>
    public async Task SetThumbnailAsync(string link)
    {
        try
        {
            ThrowIfUnauthorized();
            IApiRequest request = ApiRequestFactory.GetApiRequest(AccessToken);
            request.Method = Method.PATCH;
            request.Path = link;
            request.Query.Add("active", "true");

            IRestResponse response = await request.ExecuteRequestAsync();

            CheckStatusCodeError(null, response, "Error Setting thumbnail image active.");

            //return response.Data;
        }
        catch (Exception ex)
        {
            if (ex is VimeoApiException)
            {
                throw;
            }
            throw new VimeoUploadException("Error Setting thumbnail image active.", null, ex);
        }
    }`

Space class - need to change the data type for "used" to long

Hello,

I have been using this project to upload videos, which has been working great. After a bit the job was throwing an exception "Value was either too large or too small for an Int32.". After digging a bit it was occuring during serialization after retrieving an upload ticket. The used amount had grown beyond an int.

I updated the VimeoDotNet.Models.Space class so "used" has the data type of "long", which corrected the issue.

Thanks

Cannot get user videos

Hi I hope that someone actually reads this project seems a little dead,

I running this through visual studio 2012 and setting AccessToken to the value of the ?code=""
which is returned when I browse to the urlAuthAddress.

When I run client.GetVideos I just get a message back "Message: {"error":"A valid user token must be passed."}"

code below
var viemoClient = new VimeoClient(clientId: ClientId, clientSecret:ClientSecret);
string urlAuthAddress = viemoClient.GetOauthUrl(RedirectUrl, new List() { "public" }, null);
var client = new VimeoClient(AccessToken);
Paginated

If you cant figure it out thanks for looking anyway

Synchronous methods can result in deadlock.

I tried using the synchronous methods (I was being lazy) in a WebApi and kept getting a deadlock. You can read about why that happens here.

If you really want to keep sync them, you would need to offload the work to another thread like so

int Sync() 
{ 
    return Task.Run(() => Library.FooAsync()).Result; 
}

But as the above link says, this should be avoided unless it is absolutely necessary.

should you expose synchronous wrappers for asynchronous methods? Please try hard not to; leave it up to the consumer of [your] method to do so if they must

Based on this I recommend that all synchronous methods be removed.

Exception "Error uploading file chunk" in UploadEntireFileAsync

We randomly get this exception when calling "UploadEntireFileAsync" in our Azure Worker. Usually it works fine (9 of 10 videos) but sometimes it fails. We cannot see any pattern on why and when it happens, and when we call this again on the same video it usually works.
Videos are typically between 30 seconds to up to 3-4 minutes.
We just updated to 0.8.2 but this does not seem to help.
Any suggestion?

Incorrectly setting clientSecret on AuthorizationClient

VimeoDotNet.Authorization.AuthorizationClient constructor is setting clientSecret to clientSecret but should be ClientSecret = clientSecret. The casing is incorrect causing the AuthorizationClient to never have the secret.

Errror Authenticating With AccessToken.

Hello, Please I think this is an issue with this library. I have upgraded restsharp, downgraded, the works and it still does not work

Could not load type 'RestSharp.Authenticators.IAuthenticator' from assembly 'RestSharp, Version=105.1.0.0, Culture=neutral, PublicKeyToken=null'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.TypeLoadException: Could not load type 'RestSharp.Authenticators.IAuthenticator' from assembly 'RestSharp, Version=105.1.0.0, Culture=neutral, PublicKeyToken=null'.

Source Error:

Line 26:         public static IEnumerable<Video> GetPromoVideos()
Line 27:         {
Line 28:             var albums = new VimeoDotNet.VimeoClient(accessToken).GetAlbumVideos(383121, null, null, null, null);
Line 29:             if (albums.total > 0)
Line 30:             {

Error in ParseModelUriId

When private link share options is selected, uploaded uri is in the form of /videos/222222222:ac55f55555.
ParseModelUriId method fail try to convert "222222222:ac55f55555" into int. change method to check ":" and convert only substring 222222222.

Solution:

public static long? ParseModelUriId(string uri) { if (string.IsNullOrEmpty(uri)) { return null; } string[] pieces = uri.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); long userId = 0; string id = pieces[pieces.Length - 1]; int pos = id.IndexOf(':'); if(pos > 0) { id = id.Substring(0, pos); } if (long.TryParse(id, out userId)) { return userId; } return null; }

Error when retrieving account information

Hi, is there any documentation for this library anywhere at all?

I've gone through the test classes to try and figure out how it should be used, and I think I'm doing this right....but I can't get the library to work at all.

Here's my initial attempt at connecting to the API and grabbing the account information:

VimeoDotNet.VimeoClient vc = new VimeoDotNet.VimeoClient(ACCESS_TOKEN);
User account = vc.GetAccountInformation();

I get an error:

An unhandled exception of type 'VimeoDotNet.Exceptions.VimeoApiException' occurred in mscorlib.dll
Additional information: Error retrieving account information.

+10GB file upload never verifies as completed

Great library, guys.

I've tested the upload operation extensively with two file sizes:

  • ~1GB
  • ~15GB

The first one always succeeds as expected, but the latter one is never able to verify that the operation has indeed finished (making my implementation wait indefinitely).

Tracing the source code flow, I suspect that the issue might originate from the use of 32bit integers when extracting Range indexes in the VerifyUploadFileAsync() method:

int startIndex = 0;
int endIndex = 0;
Parameter rangeHeader =
response.Headers.FirstOrDefault(h => string.Compare(h.Name, "Range", true) == 0);
if (rangeHeader != null && rangeHeader.Value != null)
{
    Match match = RangeRegex.Match(rangeHeader.Value as string);
    if (match.Success
        && int.TryParse(match.Groups["start"].Value, out startIndex)
        && int.TryParse(match.Groups["end"].Value, out endIndex))
    {
        verify.BytesWritten = endIndex - startIndex;
        if (verify.BytesWritten == uploadRequest.FileLength)
        {
            verify.Status = UploadStatusEnum.Completed;
        }
    }
}

verify.BytesWritten variable is always 0, so I expect that the int.TryParse() method fails silently.

I get all video information but do not get the images

I get all video information but do not get the images.

VimeoDotNet.IVimeoClient cliente = new VimeoDotNet.VimeoClient(accessToken);
VimeoDotNet.Models.Video video = cliente.GetVideo(idvideo);

Results:
pictures.Count = 6
pictures.active = false
pictures.sizes = null
pictures.uri = null

Getting data from the next page

I am using GetAlbumVideos(albumID) and by default, it seems to only return the first page restricted to 25 items.
How do l use this method to return the rest of the data that don't belong to the first page?
If need be, how do l increase the page size (per_page)?

using this wrapper in MVC

Hi,

any idea why using this wrapper in an MVC asp web project causes it to hang once the Autherization is complete and any function is called (i.e client.GetAccountInformation(); )

i can see it open a socket to the API url but seems to hang after that.

i have downloaded your project and run the tests which work fine when i add my access token .. but am stuck why it hangs when its inside a MVC web project

Cheers
Niro

RestSharp IRestResponse on client.Execute hangs forever

Not sure whether this is part of your solution issue, also looking at the code you are using async task a bit in wrong approach.
After retrieving authorization code, trying to call vimeoclient.GetAccessToken specifying the same redirect_uri as in previous step just hangs application and doesn't get response, I assume there are issues with RestSharm version used in that build.

Error after updating RestSharp to 105.2.3.0

When using the latest RestSharp NuGet, I get the following error:

Could not load type 'RestSharp.IAuthenticator' from assembly 'RestSharp, Version=105.2.3.0, Culture=neutral, PublicKeyToken=null'.
--- at VimeoDotNet.Net.ApiRequest.PrepareRequest() at VimeoDotNet.Net.ApiRequest.GetAsyncRequestAwaiter[T]() at VimeoDotNet.Net.ApiRequest.<ExecuteRequestAsync>d__3`1.MoveNext() 
--- End of stack trace from previous location where exception was thrown 
--- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at VimeoDotNet.VimeoClient.<GetVideoAsync>d__68.MoveNext()

Error generating upload ticket.

Hello

I want to upload my video stream to vimeo
I got this error into InnerException
"Could not load type 'RestSharp.Authenticators.IAuthenticator' from assembly 'RestSharp, Version=105.1.0.0, Culture=neutral, PublicKeyToken=null'."

My Code:
Note: Error throw from "vc.StartUploadFile(bc, contentLength)"

public static string UploadVideo(MemoryStream filestream, int contentLength)
{
try
{
VimeoDotNet.VimeoClient vc = new VimeoDotNet.VimeoClient("Bearer **********...");
var binaryReader = new BinaryReader(filestream);
BinaryContent bc = new BinaryContent(filestream, "video/mp4");
vc.StartUploadFile(bc, contentLength);

        }

        catch (Exception h)
        {

            throw;
        }

       
        return "Failed";
    }

vimeo-dot-net show error when installing from nuget on VS 2015 RC

VimeoDotNet3
Severity Code Description Project File Line
Error Could not install package 'RestSharp 105.1.0'. You are trying to install this package into a project that targets 'Windows,Version=v8.1', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author. 0

Cannot get Thumbnails when using from nuget

When using GetVideoAsync from NuGet package i don't get the Thumbnails.
After investigating I noticed that "VimeoDotNet.Models.Picture" is defined differently in NuGet compared to the code that I can download from github.

From NuGet (erroneous definition):

namespace VimeoDotNet.Models
{
    [Serializable]
    public class Picture
    {
        public Picture();

        public int height { get; set; }
        public string link { get; set; }
        public PictureTypeEnum PictureType { get; set; }
        public string type { get; set; }
        public int width { get; set; }
    }
}

From the code downloaded here (correct definition):

namespace VimeoDotNet.Models {
    [Serializable]
    public class Picture {
        public bool active { get; set; }
        public string uri { get; set; }
        public List<Size> sizes { get; set; }
    }
}

VimeoApiException should be public

Why this exception is internal? I need to catch this specific exception in order to convert the error to user friendly message.

Thanks.

Update to 0.8.2 does not retreive videos

After updating vimeodotnet to 0.8.2 and restsharp to 105.2.3, when i call the method

var client = new VimeoClient(accessToken);
var vimeos = await client.GetVideosAsync();

I get error: "error":"You must provide a search query.".
We were using an old version of vimeodotnet earlier that used
var vimeos = await client.GetAccountVideosAsync();
to get the videos.

I have tried the solutions suggested in #43 using the Task.Run() but it still gives me the same error.

I tried the getting a single video with clip Id as below and it works fine
var video = await client.GetVideoAsync(clipid);

Update:
i tried passing my useid and use the GetUserVideosAsync() menthod and it worked.
a Check and i realized that the endpoint called does not seem to append me

https://api.vimeo.com/videos?access_token=xxxxxxx
instead of
https://api.vimeo.com/me/videos?access_token=xxxxxxx

Am i missing something?

Thanks,
Deepika

RestSharp error

Hi, I feel like I'm missing something obvious here. I've been trying to authenticate using every way I can find and so far I just keep running into the same error about RestSharp.

Error retrieving information from Vimeo API.
Could not load type 'RestSharp.* < This will change based on what function I use

I am new to Oauth2 but I believe I'm doing this right. In this specific case I'm using a personal access token I created in my Vimeo Developer page. I've tried to upgrade to a new version of RestSharp but that just results in any Vimeo query freezing up the program.

Any ideas?

protected async void Page_Load(object sender, EventArgs e)
{
    try
    {
        VimeoClient VC;
        VC = CreateAuthenticatedClient();
        Task<User> account = VC.GetAccountInformationAsync();

        User accountResult = await account;
        Response.Write(accountResult.name);
    }
    catch (Exception ex)
    {
        Response.Write(ex.Message + "<br />" + ex.InnerException);
    }
}

private VimeoClient CreateUnauthenticatedClient()
{
    return new VimeoClient(ClientID, ClientSecret);
}

private VimeoClient CreateAuthenticatedClient()
{
    return new VimeoClient(AccessToken);
}

Thanks,
Michael

GetAccountVideoAsync not getting videos?

It might be an issue on vimeo's end. When calling GetAccountVideoAsync with a valid clip id, it's not returning anything. Is this working for you? I uploaded a video through the api but set the privacy to only be accessible through me. When the video's privacy is set to "Hide this video from Vimeo.com", the request returns null. When it's set to "Anyone", the data is returned.

I'm calling this with an AccessToken. Are you calling it with something else?

Set domain whitelist

Hi there,

There's currently no support in the library for setting the domain whitelist for videos - if I add the functionality and make a PR would you accept it?

Cheers,

Callum

Unable to get videos on next page.

Hi Guys,
I am getting User Videos by below method.
var GetVideosOfUser = req.GetUserVideos(14194581,1,20)
its giving me 20 videos on first page.
Now i want to get next 20 how can i get those?

Error when retrieving account information

VimeoDotNet.VimeoClient vc = new VimeoDotNet.VimeoClient(ACCESS_TOKEN);
User account = vc.GetAccountInformation();

I get an error:

An unhandled exception of type 'VimeoDotNet.Exceptions.VimeoApiException' occurred in mscorlib.dll
Additional information: Error retrieving account information.

From code debugging get Status = WaitingForActivation

package restore failed rolling back package changes

I am working on windows 10 universal app and trying to install "VimeoDotNet" from "nuget". and getting error "package restore failed rolling back package changes". I have tried with multiple versions available their but same error for all.

0.8.0 not compatible with .NET 4.5?

I tried to upgrade to 0.8.0 but I get this message:

Could not install package 'VimeoDotNet 0.8.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

Is this the expected behaviour?

New rate limits in vimeo

Hello,

Vimeo hs introduced rate limiting in its API. This from an email I received:

Rate limit information is returned in the header of the response in the following format:

  • X-RateLimit-Limit →[total number of requests you're allowed to make]
  • X-RateLimit-Remaining →[number of requests remaining within time period]
  • X-RateLimit-Reset →[date/time the rate limit resets in UTC, formatted per ISO 8601: https://www.w3.org/TR/NOTE-datetime.]

More information here:
https://developer.vimeo.com/guidelines/rate-limiting

Is there a way to get this info via the library? If not, any possibility for future support of this?

RateLimitReset should be UTC, not Local time

There is time-zone inconsistency in how the rate limit reset date is returned. The X-RateLimit-Reset header is returned in UTC and the RateLimitReset property should not convert that to nor interpret that value as local time.

See the code here.

Example video information

Please help me. I use vimeo api for get thumb and download link of my private video allow URL.
I tre to use this library but I don't understand the Step. Do You have an example?

Vimeo API working fine with Test case but not with windows application

Hi,

I am working on vimeo api and download example code. Its working fine for Test case(VimeoDotNet.Tests). but when i try with windows application(C#) and pass reference of Vimeodotnet dll. its not working for sync call methods. My screen hang after call sync method.Please help me to find out issues.

Thanks in advance

Query

How to search in the tags

Update Album not working.

I created a vimeo App with all necessary Scopes(permissions). But requests just submitting without error. But it's not reflecting in vimeo. Could you please help me.

vimeo video tracking

Is it possible to insert data from vimeoplayer to database that the player is "PLAYING" when it is playing mode and "PAUSED" when it is in paused mode and "COMPLETED" when it is ended.
I wrote a code like this

player.on('play',function (event) {

                            playerStart(this, videoID, '');
                            
                        });
                        player.on('pause', function (event) {playerPaused(videoID); 
                      
                        });                             
                        player.on('ended',function () { playerCompletedEvent(videoID); 
                           
                        }); 

Tracking code in seperate file

var PlayerObjs = {};
var arrays_created = 0;
var TimersForPLayer = {};
var CompletedPlayers = {};
var trackingIDs = {};
var strids = "0";
function playerStart(player, videoID, hdnvarID) {
if (strids.indexOf(videoID) < 0) {
TimersForPLayer[videoID] = 0;
CompletedPlayers[videoID] = 0;
trackingIDs[videoID] = 0;
if (strids == "0")
{
strids = videoID;
}else{
strids = strids + "," + videoID;
}
}

if (TimersForPLayer[videoID] == 0) {
    if ($(PlayerObjs[videoID]).length > 0) {
        TimersForPLayer[videoID] = 1;
        window.setInterval("trapCode(" + videoID + ",'" + hdnvarID + "')", (videoUpdateDuration*1000));
    }
    else {
        PlayerObjs[videoID] = player;
        TimersForPLayer[videoID] = 1;
        window.setInterval("trapCode(" + videoID + ",'" + hdnvarID + "')", (videoUpdateDuration*1000));
    }
}

}
function trapCode(videoID, trackerid) {
if (CompletedPlayers[videoID] == 0) {
sendAjaxCall(videoID);
if (trackerid != "") {
if ($('#' + trackerid).length > 0) {
$('#' + trackerid).val(trackingIDs[videoID]);
}
}
}
}
function playerCompletedEvent(videoID) {
CompletedPlayers[videoID] = 1;
sendAjaxCall(videoID);
}
function playerPaused(videoID) {
sendAjaxCall(videoID);
}
function sendAjaxCall(videoID) {
try {
$.post("Tracking.aspx",
{ 'MemberID': sessionMemberId,
'ProspectID': sessionProspectId,
'VideoID': videoID,
'WebSiteID': sessionWebSiteId,
'WatchVideoID': trackingIDs[videoID],
'IsVideoManager': false,
'ReturnedFromAsp': false,
'PlayTime': parseInt(PlayerObjs[videoID].getPosition()),
'PlayerStatus': PlayerObjs[videoID].getState(),
'BrowserAgentName': browserName,
"t=": Math.random()
},
function (data) {
if (trackingIDs[videoID] == 0) {
trackingIDs[videoID] = data;
}
}
);
}
catch (ex) {
}
}

This code should send an Ajax call to the 'Tracking.aspx' file. By using 'Tracking.aspx.cs' file i have to insert status into database.
The vimeoplayer is having event like " event = Object {seconds: 30.05, percent: 0.135, duration: 222.99}"
I want an event like "event = Object {oldstate: "PAUSED", newstate: "PLAYING"}" to insert into my database.
Is the vimeoplayer support event objects like state?

Unlisted missing from VideoPrivacyEnum

API allows setting of Unlisted but it's not in VideoPrivacyEnum so can't be set.
public enum VideoPrivacyEnum
{
Unknown = 0,
Nobody = 1,
Anybody = 2,
Contacts = 3,
Users = 4,
Password = 5,
Disable = 6,
Unlisted = 7
}

optimize response using json filter to get a better rateLimit

As it is said in the title, I am trying to use json filter to get a better rateLimit which is currently set at 100 in my app, wich is the minimum. I read in the vimeo guide (https://developer.vimeo.com/guidelines/rate-limiting) that it would automaticaly be raised if you use json filter.
The thing is I do not really know where and what to change in your code to achieve that. So I would greatly appreciate a little bit of help.
(I will probably achieve something on my own but it would require much more time I think --')

Anyway thank you for the great library =).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.