[plugin] Youtube player

1 favourites
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Hi rexrainbow,

    Do you think the plugin could:

    • hide control bar (user cannot play, stop, go forward by controls)
    • detect if link is broke
  • Update

    Add property "Control bar" to disable control bar. But the video could still be paused or resumed by clicked.


    I only add the 1st requirement.

  • Great rexrainbow!

  • This morning I came up with an idea that requires a stream player. You may imagine how happy I was to find this "fresh" plugin. Great work (as always) rexrainbow THNX

    Few questions/issues:

    1. Is it possible to add a mechanism that will allow objects over the video? This would be very handy...

    2. Is it possible to have a parameter that hides Youtube's info at the top (name/watch later/share)?

    3. Is it possible to have a parameter that disables play/pause upon video clicked?

    4. In order to run some tests I created this project that includes two Time-code counter videos running in-sync. Here are some of the results:


    a. The plugin runs nicely over desktop and mobile via wifi, but its response is quite far from being accurate - the average response to action.pause is around 0.3 sec. Also - each player has a slightly different response time. You can test it by setting a desired pause time on the AutoPause variable.

    b. When looping at the end of the video, the plugin shows the "suggestions" screen for a split second. I worked around this issue with the "clean loop" action (enable line 8 to activate "clean loop").

    c. SetPlaybacktime does not work on "skip" (for example, when JumpFrom=3 and JumpTo=7)

    The same action works fine on "repeat" (JunpFrom=7 and JumpTo=3)

    When you use the capx, make sure to always close the tab you have used for the last preview (some inconsistency when re-launching a preview in a "used" tab).

  • rexrainbow

    I implemented 2 new properties, 1 Condition and 1 expression:


    • Show Info: informations that appears on top of the video
    • Dissable keyboard: enable/disable keyboard to play/pause/forward etc


    • onError: If the video return any error (2, 5, 101, 150), the plugin is triggering it now.


    • ErrorMessage: brings the error number (works just using the ID property in edit mode, if loads the video by "load video" on runtime, it returns 150 most time).

    Demo: http://fabiocolombini.comli.com/youtube/

    Download: http://fabiocolombini.comli.com/youtubePlugin/youtube.rar

    If you wanna take a look at it, I commented all my modifications with "frcol".

    I really hope you don´t care about it. I just needed these functionallities and implemented. So, if I have it working, the best thing to do is share it. And I think it´s not fair to rename it and put in another place for downlaod, because all the credits is for you. If somehow you don´t like it, just tell me what to do.

    I REALLY aprecciate your work and wanna humbly help.


    1- I think it´s not possible because it´s a DOM element <iframe>

    2- I think it´s working.

    3- The click on the video, i think it´s not possible. I didn´t find anything about it in Youtube API.

  • frcol

    Thanks for sharing these code, I would merge them as soon as possible.

    Here is a solution to get video info like url of webm video by video ID.

    But I could not run it locally, error message No 'Access-Control-Allow-Origin' header is present... had shown. ( The data could be fetched by browser directly. )

    Any idea?

  • Update

    • Add property "Show info", "Keyboard control".
    • Add trigger "condition:On player error" and expression:ErrorCode to get error code while error occurred.

    Thanks for sharing these code, frcol

    But I rename expression:ErrorMessage to expression:ErrorCode since the error data is a number.

  • Ok rexrainbow

    I´ll update here.

  • Thnx for the update rexrainbow and frcol

    I just found this suggested solution for non-floating iframe http://www.electrictoolbox.com/float-div-youtube-iframe/ He also suggests control over youtube's suggestions display at the end of the video. I'm not a programmer, but it seems that this solution could be implemented quite easily. Is it possible?

    [quote:3hgb5vr9]SetPlaybacktime does not work on "skip" (for example, when JumpFrom=3 and JumpTo=7)

    The same action works fine on "repeat" (JunpFrom=7 and JumpTo=3)

    rexrainbow - Is this a Youtube API issue or a bug in the plugin?

    I understand that disabling the mouse is not possible via API.

    In my game, on mouseclick.YoutubePlayer I want events to occur while the youtube player keeps playing. Does anyone have an idea for a work-around?

  • MaorKeshet

    [quote:29eeg8c8]SetPlaybacktime does not work on "skip" (for example, when JumpFrom=3 and JumpTo=7)

    The same action works fine on "repeat" (JunpFrom=7 and JumpTo=3)

    Could you provide a simple capx for this bug?

    All html elements like textbox object in C2 could not be overlapped by other sprites, since html element is not in canvas. They are at the top of all sprites.

    I tried to find a solution to play youtube video by official video plugin, which could be overlapped by sprites (ideally, I had not tried yet) , but had not success yet.

  • https://www.dropbox.com/s/62h7dg6p6psopv4/tube%20test.capx?dl=0

    It is on my first post, I think you missed it when you got exited about frcol's additions

  • Upate

    Add "condition: Compare playback time" to compare current playback time. And expression:VideoState to dump state of current video, for debug.


    Repeat: If PlayBackTime >= 7 then Set playback time to 3 , i.e go back previous playback time

    It works by my test. (Sampe capx)

    But skip: If PlayBackTime >= 7 then Set playback time to 3 will cause youtube player to "buffering" state. I have no idea how to solve it.

  • But skip: If PlayBackTime >= 7 then Set playback time to 3 will cause youtube player to "buffering" state. I have no idea how to solve it.

    I guess you meant playback>=3 and set to 7.

    Same results here... Seems to be an API issue, maybe on youtube's end.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Love your plugin Rex, it's great.

    Just one issue. I need it to be initially invisible, but unlike the standard Video plugin, your player plugin doesn't have the "initial visibility" property or the ability to set visible/invisible from code using the "Set Visible" action.

    Could you add this to the plugin? I could edit the js code, but I always prefer if the author makes changes to their own plugins (ensures we all have the same version).

    Thanks for this.

  • Update

    Add property "Initial visible" and "action: set visible". Also fixed a bug while set position and size during playing video.


    Try this new version.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)