question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Changing width of player

See original GitHub issue

I’m trying to use a 220px wide player, rather than 460, but am having issues adjusting accordingly. I have the player at a 220px with, play button is fine, and progress bar width is fine, but am having issues. I can not get the time to show. I know I am missing something, but can’t figure out what. Any help is greatly appreciated. Changes I made are below:

Changed width to 220px

.audiojs { width: 220px; height: 36px; background: #404040; overflow: hidden; font-family: 
monospace; font-size: 12px; background-image: -webkit-gradient(linear, left top, left 
bottom, color-stop(0, #444), color-stop(0.5, #555), color-stop(0.51, #444), color-stop(1, 
#444))

Changed width to 120px

.audiojs .scrubber { position: relative; float: left; width: 120px; background: #5a5a5a; 
height: 14px; margin: 10px; border-top: 1px solid #3f3f3f; border-left: 0px; border-bottom: 
0px; overflow: hidden; }

You can see it live at http://www.keepingcurrentmatters.com/test/player/

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
brendoncommented, Jan 14, 2015

Here’s a more responsive solution:

.audiojs {
    display: table;
    width: 100%;
    height: 34px;

    .play-pause, .scrubber, .time {
        display: table-cell;
        float: none;
        height: auto;
        vertical-align: middle;
    }

    .play-pause {
        padding: 0 6px;

        > p {
            margin: 0;
            padding: 0;
            height: 26px;
        }
    }

    .scrubber {
        width: 99%;
        margin: 0;
        padding: 0;

        > div {
            position: relative;
            margin: 0;

            &.progress {
                z-index: 2;
            }

            &.loaded {
                margin-top: -14px;
                z-index: 1;
            }
        }
    }

    .time {
        line-height: normal;
        margin: 0;
        padding: 0 12px;
        width: auto;
    }
}

It’d be great if the width of the progress bars were set in percentages instead of pixels, then it could be truly responsive.

0reactions
jtphelancommented, Sep 10, 2015

This works well for me.

LESS

.audiojs * { -webkit-box-sizing: border-box;  -moz-box-sizing: border-box; box-sizing: border-box; }
.audiojs { height: 2.5em; color: #fff; background: #333; position: relative; z-index: 1; }
.audiojs > div { position: absolute; }
.audiojs {
  .play-pause { width: 2.5em; height: 100%; text-align: left; text-indent: -9999px; cursor: pointer; z-index: 2; top: 0; left: 0; border-right: 1px solid #111;
    p { display:none; }
    .play { width: 0; height: 0; border: 0.5em solid transparent; border-right: none; border-left-color: #fff; content: ''; position: absolute; top: 50%; left: 50%;     margin: -0.5em 0 0 -0.25em; }
    .pause { width: 0.75em; height: 0.75em; position: absolute; top: 50%; left: 50%; margin: -0.375em 0 0 -0.375em;}
    .pause:before, .pause:after { width: 40%; height: 100%; background-color: #fff; content: ''; position: absolute; top: 0; }
    .pause:before { left: 0;}
    .pause:after { right: 0;}
  }
  .play-pause:hover, .play-pause:focus {background-color: #222;}
  .time { width: 8.75em; height: 100%; line-height: 2.5em; /* 40 */ text-align: center; z-index: 2; top: 0; border-left: 1px solid #111; right: 0; }
  .scrubber { height: 0.875em; /* 14 */ background-color: #222; cursor: pointer; z-index: 1; top: 50%; right: 9.75em; /* 110 */ left: 3.5em; /* 110 */ margin-top: -0.438em; 
    div { width: 0; height: 100%; position: absolute; left: 0; top: 0;}
    .loaded {background-color: #555;  z-index: 1;}
    .progress {background: green; z-index: 2; }
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I change the player width and height?
Hover your cursor over the player and click Settings. Hovering over a player to click Settings. ... Select Design in the Settings tab....
Read more >
Change video player size - YouTube Help - Google Support
If you want to manually change the size of your video player, simply adjust the size of your browser. You can also select...
Read more >
Sizing the Player - Brightcove Player Documentation
Player size – The player width and height properties, set in the CSS or HTML code, control the size of the player. As...
Read more >
How to set the height and width of the video player in HTML5
Approach: The HTML5 width and height attributes of the video tag are used to set the height and width of the video player...
Read more >
How To Change the Player Dimensions on Your Embed Code
How To Change the Player Dimensions on Your Embed Code · Step 1: Choose the Content to Embed · Step 2: Find and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found