Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

94
Views
How apply src from object when using video-js

I am having hard time using video-player for streaming m3u8 videos Below works but I want to use src from object

<video
            id="my-video"
            class="video-js"
            autoplay
            preload="auto"
            data-setup="{}"
        >
            <source type="application/x-mpegURL"
            src=https://multiplatform-f.akamaihd.net/i/multi/will/bunny/big_buck_bunny_,640x360_400,640x360_700,640x360_1000,950x540_1500,.f4v.csmil/master.m3u8
            />
        </video>

Instead of using hard coded src, I am trying to get src from an object that looks like this :

    post: [{post_no:1,post_author:"Mercy", url:"http://demo.unified-streaming.com/video/tears-of-steel/tears-of-steel.ism/.m3u8",},],

So I thought I could do something like this which none of them worked

idea 1

<video
            id="my-video"
            class="video-js"
            controls
            autoplay
            preload="auto"
            data-setup="{}"
        >
            <source type="application/x-mpegURL"
            :src="post.url"
            />
        </video>

idea 2

playerOptions: {
                    preload: "auto",
                    autoplay: true,
                    muted: true,
                    loop: true,
                    aspectRatio: "4:3",
                    sources: [
                        {
                            type: "application/x-mpegURL",
                            src: this.post.url,
                        },
                    ],
                },

Sadly, none of them worked. Is there any way I can do?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I managed to figure it out. Instead of using method, using created() solved this problem. So my source code is like this :

    created() {
            this.playerOptions = {
                preload: "auto",
                autoplay: true,
                muted: true,
                loop: true,
                aspectRatio: "4:3",
                sources: [
                    {
                        type: "application/x-mpegURL",
                        src: this.post.url,
                    },
                ],
            };
        },
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!