Giter VIP home page Giter VIP logo

react-native-vimeo-iframe's Introduction

React Native Vimeo Iframe

React Native Vimeo Iframe is a library to render Vimeo videos in a React Native app. This component allows you to embed a Vimeo video in your app and have full access to the Vimeo player JS API (more information https://developer.vimeo.com/player/js-api).

Installation

  1. Go through the instructions for installing the React Native Webview library: https://github.com/react-native-webview/react-native-webview.
  2. Run npm install react-native-vimeo-iframe or yarn add react-native-vimeo-iframe within your project.
  3. Compile and build to make sure everything is set up properly.

Usage

  const videoCallbacks = {
    timeupdate: (data: any) => console.log('timeupdate: ', data),
    play: (data: any) => console.log('play: ', data),
    pause: (data: any) => console.log('pause: ', data),
    fullscreenchange: (data: any) => console.log('fullscreenchange: ', data),
    ended: (data: any) => console.log('ended: ', data),
    controlschange: (data: any) => console.log('controlschange: ', data),
  };

  return (
     <Vimeo
            videoId={'712158285'}
            params={'api=1&autoplay=0'}
            handlers={videoCallbacks}
          />
  )

Supported listeners

'controlschange', // The visibility of the controls changed.
'fullscreenchange', // The orientation was changed.
'audioprocess', // A entrada do buffer de ScriptProcessorNode está pronta para ser processada
'canplay', // The browser can play the file, but estimates that there will not be enough data to play the file without interruption to reload the buffer.
'canplaythrough', // The browser estimates that it will be able to play the file without interruption until the end.
'complete', // OfflineAudioContext rendering is finished.
'durationchange', // The duration attribute has been updated.
'emptied', // Absence of content. For example, this event is sent if the media has been loaded (or partially) and the load() method has been called to reload the content.
'ended', // Playback ended due to end of content
'loadeddata', // The first frame of media has been loaded.
'loadedmetadata', // The metadata has been loaded.
'pause', // Playback has been paused.
'play', // Playback has started.
'playing', // Playback is ready to start after being paused, or delayed due to lack of data.
'ratechange', // Playback rate has changed.
'seeked', // Search operation completed.
'seeking', // Search operation started.
'stalled', // The user agent is trying to fetch media data, but data is unexpectedly not forthcoming.
'suspend', // Media data loading has been suspended.
'timeupdate', // The time indicated by the currentTime attribute has been updated.
'volumechange', // The volume has changed.
'waiting'

Available Props

Name Type Default Description
handlers { [key: string]: any } {} Listeners to be attached in the Vimeo Player
videoId string undefined The video id which will be rendered
params string undefined Extra params to be attached on the vimeo player url
reference string undefined In order to support private videos you can specify the reference prop
otherProps WebViewProps {} To customize the webview that wraps the player, you can specify additional props

Example

If you want to see MetaLabs-inc/react-native-vimeo-iframe in action, just move into the example folder and run yarn && cd ios && pod install && cd .. && yarn ios or yarn && yarn android. By seeing its source code, you will have a better understanding of the library usage.

Contributors


Marco Fiorito

Douglas Rosa

Felipe Najson

JB Paul

Salman Khan

Acknowledgements

  • @Myagi for react-native-vimeo, I based on that library to make that library with the latest versions of react-native.

react-native-vimeo-iframe's People

Contributors

demchenkoalex avatar felipe-najson avatar hishammubarak avatar marcof09 avatar marcoo09 avatar salmank81099 avatar shasikhan avatar vdanylov avatar yjb94 avatar zeusstl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-native-vimeo-iframe's Issues

library issue

\node_modules\react-native-vimeo-iframe\src\template\index.ts: Did not expect a type annotation here. (2:9)

1 | export default webplayer (

2 | videoId: string, this take problem
| ^
3 | loop: boolean,
4 | autoPlay: boolean,
5 | controls: boolean,

firstly not include ./template and type.ts first error
if run but video not play
what the exist issue ,can you identify then

loadedmetadata prop not working ?

I have tried using loadedmetadata inside the handlers props. But there aren't any logs getting printed. Kindly help.

const videoCallbacks = {
timeupdate: data => console.log('timeupdate: ', data),
play: data => console.log('play: ', data),
pause: data => console.log('pause: ', data),
fullscreenchange: data => console.log('fullscreenchange: ', data),
ended: data => console.log('ended: ', data),
controlschange: data => console.log('controlschange: ', data),
loadedmetadata: data => console.log('loadedmetadata', data),
loadeddata: data => console.log('loadeddata', data)
}

return (
<Vimeo
videoId={'741193833'}
params={'api=1&autoplay=0'}
={videoCallbacks}
containerStyle={{
height: 150,
width: '100%'
}}
otherProps={{ allowsInlineMediaPlayback: true }}
/>
)

Lacking video

While integrating vimeo inside webview in android the video starts lacking.

Media controls looks quite small for mobile screens

Description

When rendering video player, the initial media controls (play button, pause button etc.) looks quite small for mobile screen. I didn't find a configurations or styling workaround for solving this. Is there a way of styling or some how increase sizes of the media controls.

Screenshot

IMG_8222

vimeo player crashing the android app

Hi, I am having an issue with a library called react-native-vimeo-iframe. The problem is that when i am rendering video in android the app got crashed i am getting an error message in logcat of the android studio which is =>
2022-12-06 14:09:19.465 11998-12078/com.dyreid A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x20 in tid 12078 (RenderThread), pid 11998 (com.dyreid).

react-native-info

System:
OS: macOS 12.6
CPU: (8) x64 Apple M1
Memory: 30.71 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.11.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 6.14.11 - ~/Documents/Projects/dyreid/node_modules/.bin/npm
Watchman: 2022.10.24.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.5.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1
Android SDK:
API Levels: 23, 29, 30, 31, 32
Build Tools: 30.0.1, 30.0.2, 31.0.0, 32.0.0, 32.1.0, 33.0.0
System Images: android-30 | Intel x86 Atom_64, android-30 | Google APIs ARM 64 v8a, android-31 | Intel x86 Atom_64, android-31 | Google APIs ARM 64 v8a, android-31 | Google APIs Intel x86 Atom_64, android-31 | Google Play ARM 64 v8a, android-31 | Google Play Intel x86 Atom_64
Android NDK: Not Found
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8193401
Xcode: 14.1/14B47b - /usr/bin/xcodebuild
Languages:
Java: 11.0.16.1 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.66.4 => 0.66.4
react-native-macos: Not Found
npmGlobalPackages:
react-native: 0.66.4

On other hand the IOS working perfectly. I am adding the code snippet which I am using to render the video

<View style={{flex:1}}>
 <Vimeo style={{height:Dimensions.get('window').width-100,}}
  videoId={idVideo[1]} // here is the video id which I am getting from the server
  handlers={videoCallbacks}/>
</View>

Customize Player

How to customize player , i just need player seek control, need to disabled like , share and fullscreen and logo as well

IOS white screen

Trying to play a video on iOS 16.4 simulator returns a white screen

Captura de Tela 2023-05-17 às 16 20 15

made it work after changing the video quality, but doesn't work on the first time loading the video(tried with and without autoplay, same result)

UI works and still tracks video progress, audio is also ok, just the image is not showing

Also tried in another iOS version(16.0) and worked fine. Apparently, the problem is only on the new iOS version

Works fine on Android

"react-native-vimeo-iframe": "^1.2.1",
"react": "17.0.2",
"react-native": "0.66.5",

How to hide the debug log from settings?

How to hide this Debug info?
Note: I have tried from my vimeo account, where unchecking the speed & quality hides the settings icon, but do not want to hide the settings Icon (speed & quality)
Screenshot 2024-01-25 at 12 34 50 AM
Screenshot 2024-01-25 at 12 34 36 AM

Library make the app crash

Have an error with the library when app start (with expo, but should be ok):

impossible to find ./template folder

any suggestions?

thanks!

Implement requestFullscreen method & callback

Hi,
The current implementation works fine but fullscreen does not rotate video to landscape, if we implement requestFullscreen method callback then the developer can force the app to rotate to landscape mode.

I need to play the video on mute

Is there a way to mute the video with a param? my video autoplays on screen navigation, but I need it to be mute for my app, is there a way to do so?

Vimeo controls overlap native iOS controls

Hi! Thanks for the component!

I'm testing it on iOS 15.0.2, I'm unable to use native iOS video controls after resizing back to original video player (from full screen to component size).

I see Vimeo original video controls overlaps native ones, Vimeo is the one working. I can't find a solution like hiding Vimeo ones but allowing native to work, or hide native and keep using Vimeo controls.

Screen Shot 2021-11-10 at 10 05 17

Thanks so much.

How can I control disable seeked?

Hi guys,

How can I not allow user seeking when play video and when full screen? Can give me the code example like this?

Thank you

Android Fullscreen doesn't work in portrait

Running Expo Go on a physical Android device, the Fullscreen behaviour seems broken.
When I press play inline, it all works well. When I then press fullscreen, it shows the player in a large white webview.

Here is the strange thing. When I minimize the app (as in; navigate away but don't kill Expo go) and come back, it shows correctly in a portrait fullscreen view. Also if I press the Android rotate button on the bottom right (which I don't know if all versions have) it works fine in landscape.

On iOS I also have no problems. So it really boils down to Android in Portrait upon first pressing the fullscreen button.

Check out this screenshot that shows my issue.
Screenshot_20230302-213914

I really want to solve this. What can I do to get this issue resolved?

Custom Controls support

Currently I cannot find a way to create custom controls.
Play/Pause buttons, Set Time Position via slider, etc.

Would this be possible to add? Or is it already possible and I am missing it?

On ios video always open if full-screen

I spend a couple of days tracking this issue. And I didn't find the answer.
Looking for help.
Why on IOS videos always play in full-screen mode, On android is ok.
I use simple code from examples.
These are my dependencies:

   "@react-native-community/masked-view": "^0.1.11",
    "@react-navigation/material-bottom-tabs": "^6.2.1",
    "@react-navigation/native": "^6.0.10",
    "@react-navigation/native-stack": "^6.6.2",
    "react": "17.0.2",
    "react-native": "0.68.1",
    "react-native-gesture-handler": "^2.4.1",
    "react-native-pager-view": "^5.4.24",
    "react-native-paper": "^4.12.1",
    "react-native-reanimated": "^2.8.0",
    "react-native-safe-area-context": "^4.2.5",
    "react-native-screens": "^3.13.1",
    "react-native-vector-icons": "^9.1.0",
    "react-native-vimeo-iframe": "^1.1.1",
    "react-native-webview": "^11.18.2",
    "styled-components": "^5.3.5"
  },

Example project cannot be run

Trying to run the example project with:

  1. npm install
  2. npm run android

Will throw the error:
> Project with path ':react-native-webview' could not be found in project ':app'.

It seems the webview is not properly configured for the example project(?)

Autoplay seems doesn't work

Autoplay functionality seems to be broken
In addition to this dependency, I am using react-native-youtube-iframe and with this the autoplay works as expected

ON-events not triggering?

The events for onReady, onPlay, onProgress, and onFinish does not appear to be triggering.
Using the code from the example in the readme, no console logs are printed, tested on iOS 14.5 in emulator (I have not tested on Android).

onReady={() => console.log('Video is ready')}
onPlay={() => console.log('Video is playing')}
onPlayProgress={(data) => console.log('Video progress data:', data)}
onFinish={() => console.log('Video is finished')}

[Critical] New videos don't play on iOS

Something changed and new videos don't work anymore on iOS in this package. The error comes from the vimeo side.

I am testing on:
iOS: 15.2
Device: any (including xcode simulators)

Screen Shot 2022-11-06 at 12 59 47 PM

Have tried uploading different video formats to vimeo and the same happens every time.

Sidenote: The same videos work in a desktop browser with the js vimeo player link and even in the Safari developer simulators on the desktop Safari.

It is making it impossible to use vimeo with this package. Has anyone else experienced this?

Not showing thumbnails

Video is working, but thumbnails are not showing.

Code:

      <Vimeo
        allowsInlineMediaPlayback={true}
        contentMode={'recommended'}
        params={`transparent=false`}
        style={styles.video}
        videoId={`${vimeoId}`}
      />

Libraries:

"react-native-vimeo-iframe": "^1.2.1",
"react-native-webview": "^11.26.0",

Froogaloop.js does not load sometimes

There are some physical locations in which the froogaloop script does not load for me:
https://f.vimeocdn.com/js/froogaloop2.min.js

This could be due to black list ip address or some other reason like that.
Or perhaps there is some variable missing in the implementation similar to how this is due to missing a required variable:
https://vimeo.zendesk.com/hc/en-us/articles/4409305565069-Embedded-player-displays-This-video-does-not-exist-message

I am trying to hardcode the entire froogaloop script into a patch for now, but it is not working, yet.

Has anyone experienced anything similar with the iframe?

(This may relate to this issue: #19 )

Automatic fullscreen on android

On iOS the player goes fullscreen once the video is loaded. I cannot replicate this behavior on android and i need to manually click on the fullscreen button. This is my config

<Vimeo videoId={this.props.route.params.videoId} params={"api=1&autoplay=1&fullscreen=1"} handlers={videoCallbacks} style={{ backgroundColor: "black" }} androidLayerType='hardware' />

Any idea to replicate this automatic fullscreen behavior on android ?

Nice lib guys, thanks.

IOS events not firing

I'm using the latest version of the library. The callback functions are not working on IOS.

Crash app when navigate to Vimeo display video screen.

Please anybody could help me to solve this problem please. I'm getting stuck on this for many days !

ENV React native

  • react native version: 0.66.4
  • react-native-vimeo-iframe:"^1.1.1"
  • ubuntu 22.04

Bug Report from flipper monitor

22:05:58.810
6077
DEBUG
#38 pc 000000000043a4fb /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+3659) (BuildId: 14a8ecfe233395490768ff3d0728c731)
22:05:58.810
6077
DEBUG
#39 pc 0000000000439513 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::onDraw(SkCanvas*)+275) (BuildId: 14a8ecfe233395490768ff3d0728c731)
22:05:58.810
6077
DEBUG
#40 pc 00000000003c3d45 /system/lib64/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+101) (BuildId: 14a8ecfe233395490768ff3d0728c731)
22:05:58.810
6077
DEBUG
#41 pc 000000000043a4fb /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+3659) (BuildId: 14a8ecfe233395490768ff3d0728c731)
22:05:58.810
6077
DEBUG
#42 pc 0000000000439513 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::onDraw(SkCanvas*)+275) (BuildId: 14a8ecfe233395490768ff3d0728c731)
22:05:58.810
6077
DEBUG
#43 pc 00000000003c3d45 /system/lib64/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+101) (BuildId: 14a8ecfe233395490768ff3d0728c731)
22:05:58.810
6077
DEBUG
#44 pc 000000000043a4fb /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+3659) (BuildId: 14a8ecfe233395490768ff3d0728c731)
22:05:58.810
6077
DEBUG
#45 pc 0000000000465049 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::forceDraw(SkCanvas*) const+233) (BuildId: 14a8ecfe233395490768ff3d0728c731)
22:05:58.810
6077
DEBUG
#46 pc 00000000004af2ab /system/lib64/libhwui.so (android::uirenderer::skiapipeline::SkiaPipeline::renderLayersImpl(android::uirenderer::LayerUpdateQueue const&, bool)+939) (BuildId: 14a8ecfe233395490768ff3d0728c731)
22:05:58.810
6077
DEBUG
#47 pc 00000000004ac799 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::SkiaPipeline::renderFrame(android::uirenderer::LayerUpdateQueue const&, SkRect const&, std::__1::vector<android::spandroid::uirenderer::RenderNode, std::__1::allocator<android::spandroid::uirenderer::RenderNode > > const&, bool, android::uirenderer::Rect const&, sk_sp, SkMatrix const&)+105) (
22:05:58.810
6077
DEBUG
#48 pc 00000000004ac431 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::SkiaOpenGLPipeline::draw(android::uirenderer::renderthread::Frame const&, SkRect const&, SkRect const&, android::uirenderer::LightGeometry const&, android::uirenderer::LayerUpdateQueue*, android::uirenderer::Rect const&, bool, android::uirenderer::LightInfo const&, std::__1::vector<android::sp<android::uire
22:05:58.820
6077
DEBUG
#49 pc 0000000000523f49 /system/lib64/libhwui.so (android::uirenderer::renderthread::CanvasContext::draw()+1465) (BuildId: 14a8ecfe233395490768ff3d0728c731)
22:05:58.820
6077
DEBUG
#50 pc 000000000052298e /system/lib64/libhwui.so (_ZNSt3__110__function6__funcIZN7android10uirenderer12renderthread13DrawFrameTask11postAndWaitEvE3$_0NS_9allocatorIS6_EEFvvEEclEv$c1671e787f244890c877724752face20+814) (BuildId: 14a8ecfe233395490768ff3d0728c731)
22:05:58.820
6077
DEBUG
#51 pc 000000000052f829 /system/lib64/libhwui.so (android::uirenderer::WorkQueue::process()+153) (BuildId: 14a8ecfe233395490768ff3d0728c731)
22:05:58.820
6077
DEBUG
#52 pc 000000000052f5af /system/lib64/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+95) (BuildId: 14a8ecfe233395490768ff3d0728c731)
22:05:58.820
6077
DEBUG
#53 pc 0000000000013c49 /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+313) (BuildId: 0b21e18f17c36471b0becec44f99518b)
22:05:58.820
6077
DEBUG
#54 pc 0000000000013489 /system/lib64/libutils.so (thread_data_t::trampoline(thread_data_t const*)+425) (BuildId: 0b21e18f17c36471b0becec44f99518b)
22:05:58.820
6077
DEBUG
#55 pc 00000000000c758a /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+58) (BuildId: 5db8d317d3741b337ef046540bbdd0f7)
22:05:58.820
6077
DEBUG
#56 pc 000000000005fd87 /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+55) (BuildId: 5db8d317d3741b337ef046540bbdd0f7)

[1.0.1]v Error: Unable to resolve module ./template

Hi, i try to use this lib, and follow the instruction and aslo see example folder in repo.
but i try to use in my code, then i facing this issue.
Unable to find "import webplayer from './template'

When i found lib in node_modules, and i didn't find any file name, ./template

Please help me to fix

how to increase player height?

Hi there,
I am integrating this library and I am showing this player in the center of the screen, But as my requirement, I can't increase the size of the player as it is always the same height. Please let me know how can I do this?

Video rerender when pressing play button

Hi,

I'vo got an issue when I attempt to play a video.
When I interact with the video (play, settings...) it makes the video rerender and the video doesn't start.
The onReady function which should log a message doesn't appear also.
I've got the image of the video so it's not related of the videoId itself (which also works in standard webview)

Here's the code which is very basic :

export default function PlayerVideo({ navigation, route }) {

  const videoData = useSelector((state) => getItem(state, "videos", route?.params?.videoId));
  const videoId = React.useMemo(() => videoData?.code?.split("/")[2], [videoData?.code]);

  return (
    <SharedSafeArea bgColor="black">
      <View style={{ flex: 1 }}>
        <Vimeo
          videoId={videoId}
          onReady={() => console.log("Video is ready")}
          onPlay={() => console.log("Video is playing")}
          onPlayProgress={(data) => console.log("Video progress data:", data)}
          onFinish={() => console.log("Video is finished")}
          loop={false}
          autoPlay={false}
          controls={true}
          speed={false}
        />
      </View>
    </SharedSafeArea>
  );
}

Note: To make the package run without error at start I had to change the path in src/index.tsx to :
import webplayer from '../lib/template'
import { LayoutProps } from '../lib/types'

I guess you're using path resolver but it is why some people run into issue of "./template missing file..."

Get height width of video

Hi,

I want to get video's width and height when it's loaded first time because I can't give height to view but width will be 100% according to view. So I need to maintain it's ratio.

ios landscape mode support

I'm trying to change to landscape mode in full screen, but I'm forced to change it in Android, but I'm curious about how to change it to landscape mode in iOS.

my code

import Orientation from "react-native-orientation-locker";

  const videoCallbacks = {
    // timeupdate: (data: any) => console.log("timeupdate: ", data),
    // play: (data: any) => console.log("play: ", data),
    // pause: (data: any) => ,
    fullscreenchange: (data: any) => setFullscreen(!fullscreen),
    // ended: (data: any) => console.log("ended: ", data),
    // controlschange: (data: any) => console.log("controlschange: ", data),
  };
  
    useEffect(() => {
    fullscreen
      ? Orientation.lockToLandscapeLeft()
      : Orientation.lockToPortrait();
  }, [fullscreen]);

 <Vimeo
          videoId="videNo"
          params={`api=0&autoplay=1&controls=1`}
          handlers={videoCallbacks}
          overScrollMode="never"
          allowsInlineMediaPlayback
        />


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.