Skip to content

[solved] electron video and image preview #28

Open
@TianyiLi

Description

@TianyiLi

目的

目前正在利用electron + vue + jsftp刻一個客戶端,其中想要做到一個preview圖片、影片的效果。
jsftp讀取檔案資料流出來確認是nodejs socket了,不過不太清楚該怎樣將他轉為video/image的方法

使用的工具

Ubuntu 16.04, vscode, electron, jsftp, vue-electron

嘗試過的解法

如附上的程式碼

程式碼

下面附上我的片段程式碼

程式碼

function streamVideo(){
      let self = this;
      let mediaSource = new MediaSource()
      this.$refs.prviewVideo.src = window.URL.createObjectURL(mediaSource)

      jsftp.get('/var/lib/ltms/transtep/man/media/full/sample.mp4', function(err, socket){
        if (err) throw new Error();
        socket.on('data', buffer=>{
          // 不清楚實作方式
        })
      })
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions