1

I am newbie in ember. In this ember app, the legacy code displays Images, but I want to add some videos between the images.

My test code is given as below, here simply replace the image with video.

    {{!-- Carousel --}}
{{#bs-carousel
    class=(concat "carousel" (if imagesLoading ' invisible height-none'))
    autoPlay=false
    interval=0
    wrap=true
    model=imageCaptures
    showControls=showControls
    showIndicators=showIndicators
    index=activeImage
    as |caro|}}
    {{#each imageCaptures as |slide|}}
        {{#caro.slide}}

            {{!-- <img alt='' src='{{slide.image_url}}'> --}}
            <video>
              <source src='{{slide.image_url}} type="video/mp4"'>
            </video>

        {{/caro.slide}}
    {{/each}}
{{/bs-carousel}}

Video is shown, but it is cut, not auto scaled in the div where the image was shown. Can you tell me how to display video in Carousel?

lei lei
  • 1,753
  • 4
  • 19
  • 44

1 Answers1

1

ember-carousel

An ember addon for Carousel component

DEMO

Usage

From within your Ember CLI application, run the following:

ember install ember-carousel

Add invoke the component as follows

{{#carousel-container transitionInterval=400 as |ui controls|}}
  <div class="carousel-body">
    {{#ui.item}}
      Emberjs
    {{/ui.item}}
    {{#ui.item}}
      Reactjs
    {{/ui.item}}
    {{#ui.item}}
      Angularjs
    {{/ui.item}}
  </div>

  <button onclick={{controls.previous}}>
    Slide Left
  </button>
  <button onclick={{controls.next}}>
    Slide Right
  </button>
{{/carousel-container}}

API

{{carousel-container}}

This is the primary component to start displaying carousel items.

Attributes
  • transitionInterval - Defaults to 500.
  • onSlide - Optional, an action that receives one parameter, an object like { index: 3, previousIndex: 2, direction: 'right' }.
    Triggered before the transition is completed.
Yielded Params

This component yields two hashes, e.g. {{#carousel-container as |ui act|}}. These parameters ui and act can be called anything, but they contain the following items:

  • ui - is a hash with the following component items:
    • item - A component that should contain your slide contents, used like so {{ui.item}}you content{{/ui.item}}.
  • controls - is a hash with the following action items:
    • previous - A closure action that changes to the previous slide.
    • next - A closure action that changes to the next slide.

Development

  • git clone this repository
  • npm install
  • bower install

Running

  • ember server
  • Visit your app at http://localhost:4200.

Running Tests

  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://www.ember-cli.com/.

SOURCE:https://github.com/selvagsz/ember-carousel#readme

Yash Chitroda
  • 645
  • 4
  • 8
  • 27